更新时间:2022-05-02 22:46:56
我不知道你是如何准备查询的?你在使用sqlcommand吗?你没有给出你的代码,我无法正确帮助你。但请看看这个链接 [ ^ ],它会对你有所帮助。
I am not sure how you are preparing the query? are you using sqlcommand ?. you did not given your code, I can't help you correctly. But look into this link[^], it will help you.
using (SqlConnection con = new SqlConnection(constring))
{
using (SqlCommand cmd = new SqlCommand("UPDATE Persons SET City = @City WHERE Name = @Name", con))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Name", name);
cmd.Parameters.AddWithValue("@City", city);
con.Open();
int rowsAffected = cmd.ExecuteNonQuery();
con.Close();
}
}
--RA
--RA