请教一下各位高手:这段更新数据库的代码编译没问题,但运行时.net提示错误“异常详细信息: system.Data.OleDb.OleDbException: UPDATE 语句的语法错误。
”。我觉得update操作没问题啊,而且我在access和sql server中都运行过这条更新语句,都能正确执行啊!updateStr=string.Format("update tableUser set password='{0}' where userName='{1}';",this.password,this.userName);
updateCommand=new System.Data.OleDb.OleDbCommand(updateStr,this.oleDbConnection1);
this.oleDbConnection1.Open();
updateCommand.ExecuteNonQuery();究竟什么问题呢?
”。我觉得update操作没问题啊,而且我在access和sql server中都运行过这条更新语句,都能正确执行啊!updateStr=string.Format("update tableUser set password='{0}' where userName='{1}';",this.password,this.userName);
updateCommand=new System.Data.OleDb.OleDbCommand(updateStr,this.oleDbConnection1);
this.oleDbConnection1.Open();
updateCommand.ExecuteNonQuery();究竟什么问题呢?
userName='{0}'",this.userName);
this.oleDbConnection1.Open();myCommand=new System.Data.OleDb.OleDbCommand(sqlQuery,oleDbConnection1);
myReader=myCommand.ExecuteReader();
if(myReader.Read()) //找到该用户名所对应的记录
{
if(this.password==this.myReader.GetString(0)) { //输入密码与数据库表中密码一致
this.myReader.Close();
this.oleDbConnection1.Close(); Response.Redirect("SetValue.aspx?userName_login="+this.userName); //跳转 } else this.Label3.Text="wrong password"; //密码错误
}
else //没有在表中找到输入的用户名,非法用户名
{
this.Label3.Text="Invalid username";
clearTextBox();
this.myReader.Close();
this.oleDbConnection1.Close();
}