上同时定义了 DataSource 和 DataSourceID。请移除一个定义。
sql="updatecarsetgotime=now(),backtime=nullwherenum='"+nums+"'";OleDbCommandMyComm=ne...
sql = "update car set gotime=now(),backtime=null where num='" + nums + "'";
OleDbCommand MyComm = new OleDbCommand(sql, MyConn);
MyComm.ExecuteNonQuery();
sql3 = "select * from car";
OleDbDataReader dr = MyComm.ExecuteReader();
dbr.DataSource = dr;
dbr.DataBind();
MyConn.Close(); 展开
OleDbCommand MyComm = new OleDbCommand(sql, MyConn);
MyComm.ExecuteNonQuery();
sql3 = "select * from car";
OleDbDataReader dr = MyComm.ExecuteReader();
dbr.DataSource = dr;
dbr.DataBind();
MyConn.Close(); 展开
1个回答
展开全部
sql3 = "select * from car"; --这一句你确信起作用了吗?
OleDbDataReader dr = MyComm.ExecuteReader();
dbr.DataSource = dr;
dbr.DataBind();
MyConn.Close();
查询最好用断开模式写:
(手写代码未测试)
sqlcommand comm = new sqlcommand();
comm.connetion = Myconn;
comm.commandtype = ....text;
comm.sqlstring = sql3;
sqldataadapert sda = new sqldataadapert(comm);
dataset ds = new dataset();
sda.Fill(ds);
然后把一个dataset实例对象(ds)进行如下操作
dbr.DataSource = ds.table[0];
dbr.DataBind();
MyConn.Close();
OleDbDataReader dr = MyComm.ExecuteReader();
dbr.DataSource = dr;
dbr.DataBind();
MyConn.Close();
查询最好用断开模式写:
(手写代码未测试)
sqlcommand comm = new sqlcommand();
comm.connetion = Myconn;
comm.commandtype = ....text;
comm.sqlstring = sql3;
sqldataadapert sda = new sqldataadapert(comm);
dataset ds = new dataset();
sda.Fill(ds);
然后把一个dataset实例对象(ds)进行如下操作
dbr.DataSource = ds.table[0];
dbr.DataBind();
MyConn.Close();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询