用户代码未处理 System.Data.SqlClient.SqlException
来源:百度知道 编辑:UC知道 时间:2024/05/21 15:47:01
用户代码未处理 System.Data.SqlClient.SqlException
Message="在关键字 'where' 附近有语法错误。"
------------------
出现错误的代码是这个:
protected void Button2_Click(object sender, EventArgs e)
{
mysqlcommand = mysqlconnection.CreateCommand();
mysqlconnection.Open();
mysqlcommand.CommandText = "update course set 课程学分='" + Convert.ToInt32(TextBox3.Text) + "',时间='" + TextBox4.Text + "',地点='" + TextBox5.Text + "', where 课程号='" + Label1.Text + "'";
int returnValue = (int)mysqlcommand.ExecuteNonQuery();
if (returnValue != 0)
{
Response.Write("<script>alert('修改成功!');</script>");
}
else
Response.Write("<script>alert('未知错误!');</script>");
}
-----------------
我实在
Message="在关键字 'where' 附近有语法错误。"
------------------
出现错误的代码是这个:
protected void Button2_Click(object sender, EventArgs e)
{
mysqlcommand = mysqlconnection.CreateCommand();
mysqlconnection.Open();
mysqlcommand.CommandText = "update course set 课程学分='" + Convert.ToInt32(TextBox3.Text) + "',时间='" + TextBox4.Text + "',地点='" + TextBox5.Text + "', where 课程号='" + Label1.Text + "'";
int returnValue = (int)mysqlcommand.ExecuteNonQuery();
if (returnValue != 0)
{
Response.Write("<script>alert('修改成功!');</script>");
}
else
Response.Write("<script>alert('未知错误!');</script>");
}
-----------------
我实在
看了错误信息,你应该是mysql命令没有对。在where那里。你应该用mysql来测试下你的代码是不是对的。
这不是你想要的吧,这是网站出问题了……你的课程号没写对。
去掉 where前面那个逗号
用户代码未处理 System.NullReferenceException
asp.net C#用户代码未处理 System.InvalidOperationException
用户代码未处理SqlException
用户代码未处理SqlException?
未处理 System.Data.SqlClient.SqlException
调试程序的时候出现用户代码未处理Exception的问题???
未处理的“System.Data.OleDb.OleDbException”类型的异常出现在 system.data.dll 中。
未处理的“System.ArgumentException”类型的异常出现在 system.windows.forms.dll 中。
未处理的“System.Data.SqlClient.SqlException”类型的异常出现在 system.data.dll 中。
未处理的“System.StackOverflowException”类型的异常出现在 system.windows.forms.dll 中。