protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text != TextBox2.Text)
{
Response.Write("<script>alert('确认新密码要与密码相同!');parent.location.href='managemain.aspx';</script>");
Response.End();
}
else
{
string ST_dns = ConfigurationSettings.AppSettings["connstr"];
SqlConnection sqlconn = new SqlConnection(ST_dns);
string sqlstring = "update ST_SpAdmin set ST_SpAdmin_pass='" + TextBox1.Text.ToString() + "' where ST_SpAdmin_name='" + Session["ST_name"] + "'";
SqlCommand Command = new SqlCommand(sqlstring, sqlconn);
sqlconn.Open();
Command.ExecuteNonQuery();--------------' ' 附近有语法错误。
sqlconn.Close();
Response.Write("<script>alert('修改成功!');parent.location.href='managemain.aspx';</script>");
Response.End();
}
}更新语句应该是没错,会哪里错啊
解决方案 »
- hashtable[key]=0;和hashtable.Add(Key, 0);有啥区别?前者不是更省事不会有碰撞异常吗?
- C#中应用SQL语言的语法问题(如何表述某一字段为空)
- javacript radio 问题
- C# 输入法怎么使它为半角啊
- 跳圈游戏...拜托大家帮忙有没有改进一下..随便什么语言...谢谢了...
- 无法将带 [] 的索引应用于“object”类型的表达式
- 怎么在自己的电脑上,构建一个网站,就和虚拟主机上的一样,请帮忙解决一下,给个详细步骤,非常感谢!!
- Sybase DataWindow.net 在 VS 2003的使用
- 高手指导我一下!~~
- 请问一个comboBox的问题
- 请教一个关于PowerDesigner的问题
- 来点会写接口的强人们
SqlCommand Command = new SqlCommand(sqlstring
加上空格
第一,TextBox1.text 已经是string 类型啦,不用在后面再加.ToString()啦
第二,Session["ST_name"]应该转换成ST_SpAdmin_name字段类型。应该是这方面的问题
谁帮我看看 要怎么改
string sqlstring = "update ST_SpAdmin set ST_SpAdmin_pass='" + TextBox1.Text.ToString() + "' where ST_SpAdmin_name='" + Session["ST_name"] + "'"; 第一,TextBox1.text 已经是string 类型啦,不用在后面再加.ToString()啦
第二,Session["ST_name"]应该转换成ST_SpAdmin_name字段类型。应该是这方面的问题
如果ST_SpAdmin_name是string类型的话,用Convert.ToString(Session["ST_name"])
调试看看语句