vb.net-初始化字符串的格式不符合从索引34开始的规范

发布于 2025-01-19 01:59:21 字数 967 浏览 4 评论 0原文

Dim path As String = xlPath
        Dim conString = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + path + "';Extended Properties='Excel 8.0;HDR=No;IMEX=1;TypeGuessRows=0;MaxScanRows=0;ImportMixedTypes=Text';")
        Dim cmd As New OleDb.OleDbCommand
        Dim MyConnection As System.Data.OleDb.OleDbConnection
        Dim dtset As DataSet

        MyConnection = New System.Data.OleDb.OleDbConnection(conString)
        cmd.Connection = MyConnection
        cmd.CommandType = CommandType.Text
        cmd.CommandText = query

        Dim MyCommand As New System.Data.OleDb.OleDbDataAdapter(cmd)
        dtset = New System.Data.DataSet
        MyCommand.Fill(dtset)

        Dim dtb As DataTable = dtset.Tables(0)

我在VB.NET中有一个连接字符串,对我以及其他一堆用户都可以正常工作。但是,有一个用户正在遇到此错误“初始化字符串的格式不符合索引34”的规范

当我在index 34检查字符34时,其末端是提供商的末尾“ provider” provider = microsoft .ACE.OLEDB.12.0“。 代码有什么问题,或者用户系统中缺少某些东西?

Dim path As String = xlPath
        Dim conString = String.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + path + "';Extended Properties='Excel 8.0;HDR=No;IMEX=1;TypeGuessRows=0;MaxScanRows=0;ImportMixedTypes=Text';")
        Dim cmd As New OleDb.OleDbCommand
        Dim MyConnection As System.Data.OleDb.OleDbConnection
        Dim dtset As DataSet

        MyConnection = New System.Data.OleDb.OleDbConnection(conString)
        cmd.Connection = MyConnection
        cmd.CommandType = CommandType.Text
        cmd.CommandText = query

        Dim MyCommand As New System.Data.OleDb.OleDbDataAdapter(cmd)
        dtset = New System.Data.DataSet
        MyCommand.Fill(dtset)

        Dim dtb As DataTable = dtset.Tables(0)

I Have a connection string in VB.NET which works fine for me as well as other bunch of users. But there is one user who is getting this error "Format of the initialization string does not conform to specification starting at index 34"

When i checked the character at Index 34 its the end of Provider "Provider=Microsoft.ACE.OLEDB.12.0".
Is there any problem with the code or is there something missing in the Users system?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文