|
Sorry, I change a question, listBox2.Text seems to take out the text content, it may be that my database execution statement is wrong, my code
string strconn;
strconn = "data source = (local); initial catalog = student_pl; Integrated Security = SSPI;";
SqlConnection cn1 = new SqlConnection (strconn);
cn1.Open ();
string s = "delete from score where cname = '" + listBox2.Text + "'";
SqlCommand cmd1 = new SqlCommand ();
cmd1.Connection = cn1;
cmd1.CommandText = s;
cmd1.ExecuteNonQuery ();
After the execution, the record I want to delete is not deleted in the database. What is wrong, please advise |
|