vb.net-初始化字符串的格式不符合从索引34开始的规范
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论