C#日历选择日期以短日期的形式表示在文本框里,删除/更新access同样日期的数据总报错
报错:标准表达式中的数据类型不匹配OleDbConnectioncon=DB.createDB();//调用用户自定义的DB类的createDB()的方法OleDbCom...
报错:标准表达式中的数据类型不匹配
OleDbConnection con = DB.createDB(); //调用用户自定义的DB类的createDB()的方法
OleDbCommand cmd = new OleDbCommand();//声明一个OleDbCommand的 cmd对象,并将其实例化
cmd.Connection = con;
con.Open(); //打开数据库连接
cmd.CommandText = "update aqi set city='" + this.TextBox1.Text + "',[date]='" + this.txttime.Text + "',aqi='" + this.TextBox2.Text + "',so2='" + this.TextBox6.Text + "',no2='" + this.TextBox7.Text + "',pm10='" + this.TextBox5.Text + "',pm25='" + this.TextBox4.Text + "' where [date]='" + this.txttime.Text + "'";
cmd.ExecuteNonQuery();//用OleDbCommand的ExecuteScalar()方法来执行修改操作
Response.Write("<script language=javascript>alert('恭喜您,信息修改成功!')</script>");
con.Close(); 展开
OleDbConnection con = DB.createDB(); //调用用户自定义的DB类的createDB()的方法
OleDbCommand cmd = new OleDbCommand();//声明一个OleDbCommand的 cmd对象,并将其实例化
cmd.Connection = con;
con.Open(); //打开数据库连接
cmd.CommandText = "update aqi set city='" + this.TextBox1.Text + "',[date]='" + this.txttime.Text + "',aqi='" + this.TextBox2.Text + "',so2='" + this.TextBox6.Text + "',no2='" + this.TextBox7.Text + "',pm10='" + this.TextBox5.Text + "',pm25='" + this.TextBox4.Text + "' where [date]='" + this.txttime.Text + "'";
cmd.ExecuteNonQuery();//用OleDbCommand的ExecuteScalar()方法来执行修改操作
Response.Write("<script language=javascript>alert('恭喜您,信息修改成功!')</script>");
con.Close(); 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询