为什么asp.net不会删除我的行
本文关键字:删除 我的 asp net 为什么 | 更新日期: 2023-09-27 18:13:01
我试图从我的数据库中删除一行,
这是我的代码:
sql = "delete sum_lines from sum_lines join sum_tbl on sum_lines.summary_id = sum_tbl.id where sum_tbl.user_id = @userId and sum_lines.line_id ='@lineId'";
SqlConnection con = new SqlConnection(conString);
dataObj = new DataObj();
SqlCommand com = new SqlCommand(sql, con);
com.Parameters.Add(new SqlParameter("@userId", userId));
com.Parameters.Add(new SqlParameter("@lineId", lineId));
con.Open();
com.ExecuteNonQuery();
con.Close();
的事情是,如果我尝试我的sql语句在管理工具,它的工作完美。但是当我的代码运行时,它不会影响我的数据库。
它确实去这个代码,我可以看到在我的调试模式,但它不会影响某些原因。有输入吗?
去掉'@lineId'
周围的单引号。用引号指定的值等于第二个条件中的@lineid
字符串。