我遇到的出现这种错误的原因一般是以下几种情况:
1.在绑定数据控件的时候,
//建立数据库连接
OleDbConnection conn = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=" + Server.MapPath("news.mdb"));
//创建OleDbDataAdapter对象,按照指定的查询语句获取结果
OleDbDataAdapter mycom = new OleDbDataAdapter("select top 12 * from contents where typeid=1 order by shijian desc", conn);
OleDbDataAdapter mycom1 = new OleDbDataAdapter("select top 12 * from contents where typeid=2 order by shijian desc", conn);
//定义DataSet对象,将查询结果填充到这个对象上
DataSet ds = new DataSet();
mycom.Fill(ds, "contents");
mycom1.Fill(ds, "types");
这个时候,如果直接绑定:
mylist.DataSour