Excel 到数据表出现错误“字段过多”
我正在将 Excel 工作表中的数据填充到数据表中。 Excel 工作表包含大约 160 列。它向“许多字段”提供错误消息
Dim largespan1 As String
Dim larg As String
Dim str, str5, str6 As String
largespan1 = "C:\shivam.xls"
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & largespan1 & ";Extended Properties=""Excel 8.0;HDR=yes;IMEX=1"""
Dim len, len1, i As Integer
Dim cmd, cmd1 As New SqlCommand()
Dim objConn1 As New OleDbConnection(sConnectionString)
Dim objCmdSelect1 As New OleDbCommand("SELECT * FROM [Master Schedule1$]", objConn1)
objConn1.Open()
Dim objAdapter2 As New OleDbDataAdapter()
objAdapter2.SelectCommand = objCmdSelect1
Dim dt5 As New DataTable
objAdapter2.Fill(dt5)
objConn1.Close()
任何人都可以建议为什么会发生这种情况 提前致谢
I am filling data from a sheet of Excel book to datatable . The excel sheet contains about 160 columns. It gives error message "to many fields"
Dim largespan1 As String
Dim larg As String
Dim str, str5, str6 As String
largespan1 = "C:\shivam.xls"
Dim sConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & largespan1 & ";Extended Properties=""Excel 8.0;HDR=yes;IMEX=1"""
Dim len, len1, i As Integer
Dim cmd, cmd1 As New SqlCommand()
Dim objConn1 As New OleDbConnection(sConnectionString)
Dim objCmdSelect1 As New OleDbCommand("SELECT * FROM [Master Schedule1$]", objConn1)
objConn1.Open()
Dim objAdapter2 As New OleDbDataAdapter()
objAdapter2.SelectCommand = objCmdSelect1
Dim dt5 As New DataTable
objAdapter2.Fill(dt5)
objConn1.Close()
Any one can suggest why it happens
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论