asp.net..Update语句有错吗??追加50分
voidbtnok_Click(ObjectSender,System.EventArgse){OleDbConnectionthisConnection=newOleD...
void btnok_Click(Object Sender,System.EventArgs e)
{
OleDbConnection thisConnection=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("../../dbs/webdata.mdb")+"");
thisConnection.Open();
OleDbCommand thisCMD=thisConnection.CreateCommand();
thisCMD.CommandText="Select password from logings where password='"+this.oldpsw.Text+"'";
OleDbDataReader thisReader=thisCMD.ExecuteReader();
if(thisReader.Read())
{
int b=1;
thisReader.Close();
OleDbCommand thisCMD2=thisConnection.CreateCommand();
thisCMD2.CommandText="Update logings set password='"+this.newpsw.Text+"' where id="+b+"";//错误提示这句Update语句语法有错。。会错吗?闷
thisCMD2.ExecuteNonQuery();
}
else
{lb4.Visible=true;}
thisConnection.Close();
}
///////////////////////////////////////////下面的是错误的详细信息:
堆栈跟踪:
[OleDbException (0x80040e14): UPDATE 语句的语法错误。]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66
ASP.replacepsw_aspx.btnok_Click(Object Sender, EventArgs e) in E:\mysky\iou\guestbook\replace\replacepsw.aspx:47
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277 展开
{
OleDbConnection thisConnection=new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("../../dbs/webdata.mdb")+"");
thisConnection.Open();
OleDbCommand thisCMD=thisConnection.CreateCommand();
thisCMD.CommandText="Select password from logings where password='"+this.oldpsw.Text+"'";
OleDbDataReader thisReader=thisCMD.ExecuteReader();
if(thisReader.Read())
{
int b=1;
thisReader.Close();
OleDbCommand thisCMD2=thisConnection.CreateCommand();
thisCMD2.CommandText="Update logings set password='"+this.newpsw.Text+"' where id="+b+"";//错误提示这句Update语句语法有错。。会错吗?闷
thisCMD2.ExecuteNonQuery();
}
else
{lb4.Visible=true;}
thisConnection.Close();
}
///////////////////////////////////////////下面的是错误的详细信息:
堆栈跟踪:
[OleDbException (0x80040e14): UPDATE 语句的语法错误。]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) +41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66
ASP.replacepsw_aspx.btnok_Click(Object Sender, EventArgs e) in E:\mysky\iou\guestbook\replace\replacepsw.aspx:47
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询