my code is this for the button
try
{
con.Open();
OleDbCommand cmd = new OleDbCommand("insert into slogin values('" + todayDay + "','" + txtDate.Text + "','" + cboStudentNo + "','" + txtLastName + "','" + txtFirstName + "','" + cboComputerNo + "')", con);
cmd.ExecuteNonQuery();
// OleDbCommand cmd2 = new OleDbCommand("update into Computer set Status='Occupied'where PcNumber='" + cboComputerNo.Text + "'", con);
// cmd2.ExecuteNonQuery();
con.Close();
Computer();
Student();
dgv();
time();
MessageBox.Show("login success");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
- computer() is for computer vacancy
- student() is for student data
- dgv() loads table
- i get this error when i press the button
- 1.System.Windows.Forms.ComboBox, Items.Count: 12 / studentID
- 2.System.Windows.Forms.TextBox, Text: Llenares / lastname
- 3.System.Windows.Forms.TextBox, Text: Nette / firstname
- 4.System.Windows.Forms.ComboBox, Items.Count: 10 / pcnumber
- the code for date and time is working.
- i am using c# and msAccess for my database