Excel 到数据表出现错误“字段过多”

发布于 2024-11-17 21:53:15 字数 785 浏览 1 评论 0原文

我正在将 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 技术交流群。

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

发布评论

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