Excel to Datatable给出错误“Too many fields”

时间:2011-06-28 13:59:38

标签: asp.net vb.net excel-2003

我正在将一张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()

任何人都可以建议为什么会这样 提前致谢

0 个答案:

没有答案