首页 新闻 搜索 专区 学院

导入dbf文件出错(jet 数据库引擎找不到对象)

0
悬赏园豆:15 [已关闭问题]
<P>&nbsp;&nbsp;&nbsp; 导入dbf文件的时候只要文件名过长就报错(Microsoft jet数据库引擎找不到对象。。。),不过换了一个名称就可以导入了。我的代码如下</P> <P>&nbsp;string tableName = "[" + Path.GetFileName(fileName) + "]";<BR>&nbsp;string directoryName = Path.GetDirectoryName(fileName);<BR>&nbsp;string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + directoryName + ";Extended Properties=dBASE 5.0;Persist Security Info=False";<BR>&nbsp;DataSet dsImport = new DataSet();<BR>&nbsp;OleDbDataAdapter adapter = new OleDbDataAdapter();<BR>&nbsp;OleDbCommand command = new OleDbCommand();<BR>&nbsp;command.Connection = new OleDbConnection(strConn);<BR>&nbsp;command.CommandText = string.Format(@"SELECT&nbsp;* FROM {0}", tableName);<BR>&nbsp;adapter.SelectCommand = command;<BR>&nbsp;adapter.Fill(dsImport, "tb_trans");</P>
TG.Yang's IT Space的主页 TG.Yang's IT Space | 初学一级 | 园豆:45
提问于:2008-07-25 13:01
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册