代码如下:
protected void Button2_Click(object sender, EventArgs e)
{ string xmbh = Session["xmbh"].ToString();
string mujd=TextBox1.Text;
string gzmb=TextBox3.Text;
string czwt=TextBox4.Text;
string rq=DateTime.Now.ToString();
string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
strConnection += Server.MapPath("db1.mdb");
OleDbConnection objConnection = new OleDbConnection(strConnection);
objConnection.Open();
OleDbCommand cmd=new OleDbCommand("insert into gcjd (xmbh,mujd,gzmb,czwt,rq)values('" + xmbh + "','"+mujd+"','"+gzmb+"','"+czwt+"','"+rq+"')", objConnection); cmd.ExecuteNonQuery();
objConnection.Close();
TextBox1.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
Response.Redirect("gcjd.aspx");
运行后就提示"System.Data.OleDb.OleDbException: 操作必须使用一个可更新的查询"不知怎么解决希望大家帮忙
protected void Button2_Click(object sender, EventArgs e)
{ string xmbh = Session["xmbh"].ToString();
string mujd=TextBox1.Text;
string gzmb=TextBox3.Text;
string czwt=TextBox4.Text;
string rq=DateTime.Now.ToString();
string strConnection = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
strConnection += Server.MapPath("db1.mdb");
OleDbConnection objConnection = new OleDbConnection(strConnection);
objConnection.Open();
OleDbCommand cmd=new OleDbCommand("insert into gcjd (xmbh,mujd,gzmb,czwt,rq)values('" + xmbh + "','"+mujd+"','"+gzmb+"','"+czwt+"','"+rq+"')", objConnection); cmd.ExecuteNonQuery();
objConnection.Close();
TextBox1.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
Response.Redirect("gcjd.aspx");
运行后就提示"System.Data.OleDb.OleDbException: 操作必须使用一个可更新的查询"不知怎么解决希望大家帮忙
解决方案 »
- URL传参数实现内容筛选出问题,急急急!
- asp.net developer express 中button控件的疑问?
- asp.net 中 数据库有TIME字段 我想在用数据绑定控件取数据的时候 做一个分周显示 请问怎么做 什么数据控件都可以 解决问题后 立即给分
- asp2.0,关于GridView分页导出Excel的问题
- asp.net2.0gridview直接连dataset好还是用Dataset连数据源控件再连gridview好呢?
- 很简单:如何用HttpWebRequest请求SSL(HTTPS),好像与HTTP有很有区别,得不到数据
- 创建asp.net程序时出错
- DataRow 取数据的简单问题,马上就结帐
- DropDownList的OnSelectedIndexChanged不响应。。。autoPostBack已经设置为true了
- 请问学习网站开发需要了解哪些知识呢?
- response.redirect(string url,bool endresponse)能在新的页面中打开网页吗?
- 初学者第一个委托为什么不好使呢,差在哪呢,?
这个问题主要是由于你的用户无权对表进行update 与insert....只能select。所以,你得为aspnet的用户增加对数据库的写入权限
设置ASP.NET用户权限
PS: 最烦用拼音写代码了.....看见就想呕