asp.net..Update语句有错吗??
错误提示下面的Update语句语法有错.加10分---------------------------------------------voidbtnok_Click(...
错误提示下面的Update语句语法有错.加10分
---------------------------------------------
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();
} 展开
---------------------------------------------
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();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询