[求助]关于ado连接的OleDbCommand错误问题(在线)
我用的access数据库我的程序代码如下:
using System.Data;
using System.Data.OleDb;
......
private void mcon_Click(object sender, System.EventArgs e)
{
OleDbConnection thiscon=new OleDbConnection (@"Provider=Microsoft.Jet.OLEDB.4.0;Data source=db.mdb");
thiscon.Open();
OleDbCommand thiscmd=thiscon.CreateCommand(); ///错误在这,运行时显示thiscmd <undefined value> System.Data.OleDb.OleDbCommand
thiscmd.CommandText="SELECT bdId,name FROM bd";
OleDbDataReader thisread=thiscmd.ExecuteReader();
while(thisread.Read())
{
Console.Write("\t{0}\t{1},thisread[bdId],thisread[name]");
}
thisread.Close();
thiscon.Close();
}
错误信息图片:
请帮帮忙,书上这样写的,不知如何改,谢谢了先!!
[此贴子已经被作者于2006-5-17 12:12:07编辑过]