找不到可安装的 ISAM

发布于 2024-12-15 06:26:50 字数 1292 浏览 2 评论 0原文

我正在使用 vb.net 2003,我想使用 OleDb 连接读取 excel 文件 2003。但是当我将 IMEX=1 属性放在连接字符串上时遇到问题。但是,当我必须删除这个 IMEX 属性时,系统运行时不会出现错误。这是我的连接字符串

xlsCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathName & " ; Extended Properties=Excel 8.0;IMEX=1")

任何人都可以帮助我解决此错误吗?我需要放置 IMEX 属性,以便它告诉驱动程序始终读取每个单元格上的混合(字符串、整数、日期)数据类型。

这是我遇到的错误。

System.Data.OleDb.OleDbException: Could not find installable ISAM.
   at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr)
   at System.Data.OleDb.OleDbConnection.InitializeProvider()
   at System.Data.OleDb.OleDbConnection.Open()
   at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
   at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at Production_Tracking_System.frmPMEFNATUpload.getUploadedData(String pathName) in D:\Legacy\Development\PTS 2 VSG-NAT\Forms\frmPMEFNATUpload.vb:line 434

I'm using vb.net 2003 and I want to read excel file 2003 using OleDb Connection. But I have a problem when I'm putting the IMEX=1 property on the connection String. But when I have to romove this IMEX property, the system run without an error. Here is my connection string

xlsCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathName & " ; Extended Properties=Excel 8.0;IMEX=1")

Can any one help me on how could i fix this error? I need to put IMEX property so that it tells the driver to always read intermixed (string, integer, date) data type on each cell.

Here is the error I've encountered.

System.Data.OleDb.OleDbException: Could not find installable ISAM.
   at System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr)
   at System.Data.OleDb.OleDbConnection.InitializeProvider()
   at System.Data.OleDb.OleDbConnection.Open()
   at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
   at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
   at Production_Tracking_System.frmPMEFNATUpload.getUploadedData(String pathName) in D:\Legacy\Development\PTS 2 VSG-NAT\Forms\frmPMEFNATUpload.vb:line 434

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

真心难拥有 2024-12-22 06:26:50

如果使用超过 1 个扩展属性,则必须用引号引起来的值标记,否则驱动程序无法将它们与连接字符串中的其他非扩展属性区分开来;

... pathName & ";Extended Properties=""Excel 8.0;IMEX=1"""

If you use more than 1 extended property then the value tokens must be quoted, otherwise there is no way for the driver to distinguish them from the other non-extended properties in the connection string;

... pathName & ";Extended Properties=""Excel 8.0;IMEX=1"""
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文