参数没有被指定问题!!郁闷
源代码:
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string Temp = Request.Params[ "iCustomerId "];
OleDbConnection myconnection = new OleDbConnection(AccessString + System .Web .HttpContext .Current .Server.MapPath(DataBase ));
OleDbCommand mycommand;
string cmd3 = "update KHGL_CustomerPerson set cCusCode= " + cCusCode_Box.Text + ",cCusName= ' " + cCusName_Box.Text + " ' where iCustomerId= " + Temp;
mycommand =new OleDbCommand (cmd3,myconnection );
myconnection.Open();
mycommand.ExecuteNonQuery();
Response.Write( "更新成功 ");
myconnection.Close();
}
查看的局部变量:
cmd3= "update KHGL_CustomerPerson set cCusCode= '1039200506090001 ',cCusName= '烟台华兴纸制品有限公司 ' where iCustomerId=11 "
------解决方案--------------------update 语句本身没有问题,
检查 字段名,表名 是否正确
------解决方案--------------------string cmd3 = "update KHGL_CustomerPerson set cCusCode= ' " + cCusCode_Box.Text + " ',cCusName= ' " + cCusName_Box.Text + " ' where iCustomerId= " + Temp;