请教!!!asp+access + c# 错误:查询值的数目与目标字段中的数目不同。
错误:查询值的数目与目标字段中的数目不同。查询语句如下:OleDbConnectioncon=newOleDbConnection();con.ConnectionStr...
错误:查询值的数目与目标字段中的数目不同。查询语句如下:OleDbConnection con = new OleDbConnection();
con.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" + Server.MapPath("~/App_Data/07wl.mdb");
con.Open();
OleDbCommand com = new OleDbCommand();
com.CommandText = "insert into liuyan values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + DateTime.Now + "','" + Request.UserHostAddress + "')";
com.Connection = con;
OleDbDataReader dr = com.ExecuteReader();
con.Close(); 展开
con.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" + Server.MapPath("~/App_Data/07wl.mdb");
con.Open();
OleDbCommand com = new OleDbCommand();
com.CommandText = "insert into liuyan values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + DateTime.Now + "','" + Request.UserHostAddress + "')";
com.Connection = con;
OleDbDataReader dr = com.ExecuteReader();
con.Close(); 展开
展开全部
access不和SQL一样,access插入你必须写你插入的字段名
access是要这样写 insert into liuyan(字段名,字段名) values(插入名,插入名);
SQL 可以这样insert into liuyan values(插入名,插入名);
access是要这样写 insert into liuyan(字段名,字段名) values(插入名,插入名);
SQL 可以这样insert into liuyan values(插入名,插入名);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
com.CommandText = "insert into liuyan(TextBox1对应的列名,TextBox2对应的列名,DateTime.Now 对应的列名,Request.UserHostAddress 对应的列名) values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + DateTime.Now + "','" + Request.UserHostAddress + "')";
com.Connection = con;
com.Connection = con;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询