Unten ist mein Add Button-Code, ich jedes Mal, um diesen Fehler geben hinzufügen klickenAusnahme geworfen: 'System.Data.SqlClient.SqlException' in System.Data.dll
command.ExecuteNonQuery();
kann mich mit dem Problem helfen?
Hier ist mein Code
private void button4_Click(object sender, EventArgs e) //Add button
{
tbLecturerId.Select();
string strID, strFirstName, strUsername, strPassword, strDepartment, strEmail;
strID = tbLecturerId.Text;
strFirstName = tbLname.Text;
strUsername = Usernametxt.Text;
strPassword = Passwordtxt.Text;
strDepartment = cbDepartment.Text;
strEmail = tbEmail.Text;
connect.Open();
SqlCommand command = new SqlCommand(@"INSERT INTO Lecturer_tbl (LecturerID,LecturertName, Username,Password, Department,Email) VALUES('" + strID + "','" + strFirstName + "','" + strUsername + "', '" + strPassword + "','" + strDepartment + "' ,'" + strEmail + "')", connect);
command.ExecuteNonQuery();
connect.Close();
displayLectureGrid();
clearLecturertbl();
Einfügen der Ausnahme Stack-Ablaufverfolgung gibt es keine Möglichkeit, die Details zu erraten –