Error reading the database, method or operation is not implemented
So after fixing an error where I was getting
studentHelperClass.Form1.cmbBox is inaccessible due to its protection
level I got this error when I launched my prorgam Error reading the
database, method or operation is not implemented by my error label.
This is my code:
public partial class Form1 : Form
{
MySqlConnection conn; // connection object;
string connstring = "server=localhost;user
Id=root;database=collegesystem;Convert Zero Datetime=True ";
public Form1()
{
InitializeComponent();
connection();
selectStudent();
}
private void selectStudent()
{
try
{
studentHelperClass.studentHC.insertMethod();
}
catch (Exception err)
{
lblInfo.Text = " Error reading the database.";
lblInfo.Text += err.Message;
}
}
That is the code for the form, the following is the class with the method
class studentHC : Form1
{
public studentHC()
{
InsertMethod();
}
private void InsertMethod()
{
MySqlConnection conn; // connection object;
string connstring = "server=localhost;user
Id=root;database=collegesystem;Convert Zero Datetime=True ";
conn = new MySqlConnection(connstring);
conn.Open();
using (var command = new MySqlCommand("SELECT * FROM person",
conn))
{
using (var myReader = command.ExecuteReader())
{
cmbBox.Items.Add(myReader["personID"]);
}
}
}
internal static void insertMethod()
{
throw new NotImplementedException();
}
}
Any input would be greatly appreciated
No comments:
Post a Comment