首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

用oledb,数据库访问出错?该怎么处理

2012-02-10 
用oledb,数据库访问出错??以下是我的代码:tringstr_oleselect*fromzs.dbf stringstr_conndatasource

用oledb,数据库访问出错??
以下是我的代码:
tring   str_ole   =   "select   *   from   zs.dbf ";
string   str_conn   =   "data   source   =   F:\\Solution\\Dbf库;provider   =   vfpoledb ";
OleDbConnection   oleconn_obj=new   OleDbConnection();
oleconn_obj.ConnectionString=str_conn;
oleconn_obj.Open();
OleDbCommand   myCommand=new   OleDbCommand(str_ole,oleconn_obj);
int   count   =   myCommand.ExecuteNonQuery();   //此处出错。
错误为:System.Data.OleDb.OleDbException:   Not   a   table.

请大家帮忙了,谢谢!!(存在zs.dbf文件)

[解决办法]
string str_ole = "select * from zs ";
[解决办法]
string str_conn = "data source = F:\\Solution\\Dbf库;provider = vfpoledb ";
改为:
string str_conn = "data source = F:\\Solution\\Dbf库\;provider = vfpoledb ";
试试
[解决办法]
string str_conn = "data source = F:\\Solution\\Dbf库;provider = vfpoledb ";
这个连接语句好像有问题,检查一下

热点排行