请高手帮我下,谢谢,我找不到这个报错的地方
高手帮我看看代码,我找不到报错的原因 ... 我用的SqlHelper 然后做一个 更新操作private void btnModfiy_Click(object sender, EventArgs e)
{
string name = txtUserName.Text.Trim();
string phone = txtPhone.Text.Trim();
string mail = txtMail.Text.Trim();
string school = txtSchool.Text.Trim();
string address = txtAddress.Text.Trim();
SqlParameter[] sp =
{
new SqlParameter("@username",(object)name),
new SqlParameter("@phone",(object)phone),
new SqlParameter("@mail",(object)mail),
new SqlParameter("@school",(object)school),
new SqlParameter("@address",(object)address)
};
string sql = "update T_Student set stuName,stuPhone,stuEmail,stuAddress,stuSchool where stuName=@username and stuPhone=@phone and stuEmail=@mail and stuAddress=@address and stuSchool=@school";
SqlHelper.SqlHelper.ExecuteNonQuery(sql,sp);
MessageBox.Show("修改成功");
}
以上都没报错
public static int ExecuteNonQuery(string sql, params SqlParameter[] parameters)
{
using (SqlConnection conn = new SqlConnection(con))
{
if(conn.State == System.Data.ConnectionState.Closed)
{
conn.Open();
}
using (SqlCommand cmd = conn.CreateCommand())
{
= sql;
if (parameters != null && parameters.Length > 0)
{
cmd.Parameters.AddRange(parameters);
}
return cmd.ExecuteNonQuery();//这行报错了 。.... 说 ',' 附近有语法错误 .... 我找不到啊 不知道怎么错了 高手帮我看下 谢谢
}
}