Hello, I'm trying to program a basic program at the moment and have run into some difficulties. I have a method as follows:
public static void loadDB()
{
// load data into datasets - this will be called on form2 the login screen
loadTblStaff();
loadTblCars();
}
the method is called on another form on load. The methods its supposed to call are as follows:
public static void loadTblStaff()
{
// prepare, open and load the staff table into dataset ds2
con.ConnectionString = dbProvider + dbSource;
MessageBox.Show("loadTblStaff() called");
con.Open();
MessageBox.Show("load table staff connection opened");
sql = "SELECT * FROM tblStaff";
ds2 = new DataSet();
da = new OleDbDataAdapter(sql, con);
da.Fill(ds2, "tblStaff");
con.Close();
}
public static void loadTblCars()
{
// prepare, open and load the cars table into dataset ds1
con.ConnectionString = dbProvider + dbSource;
MessageBox.Show("Loadtablecars called");
con.Open();
MessageBox.Show("load table cars connection opened");
sql = "SELECT * FROM tblCars";
ds1 = new DataSet();
da = new OleDbDataAdapter(sql, con);
da.Fill(ds1, "tblCars");
con.Close();
}
I'm not sure why the program isnt working, but I tried to use messageboxes to find out where the program failed and it seems after the loadDB method there are no calls. I'm new to c# so I am not sure why this is. Please advise.