使用此代码而不添加复选框,使其正常工作
try
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
command.CommandText = "insert into StudentInformation ([StudentID], [Lastname], [Firstname], [Middle initial], [Course], [Year], [Sem]) values ('" + txtStudentID.Text + "' , '" + txtStudentFN.Text + "','" + txtStudentFN.Text + "','" + txtStudentMI.Text + "','" + txtCourse.Text + "','" + txtYear.Text + "','" + txtSem.Text + "')";
command.ExecuteNonQuery();
MessageBox.Show("Added Successfully!");
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
但是当我添加复选框时
"insert into StudentInformain ([StudentID], ..... [Transferee] values ('" + txtStudentID.Text + "' ,...... '" + CheckBoxTrans + "')";
我收到了一个错误 对不起,我的英语不好 我如何在我的数据库中添加检查 (注意不是复选框的值)