|

楼主 |
发表于 2020-1-5 15:15:01
|
显示全部楼层
不好意思,我换一个问题,listBox2.Text好像取出文本内容,可能是我的数据库执行语句写错了,我的代码
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();
执行后,数据库中并没有删除我想删除的纪录,是哪个地方错了呢,请指教 |
|