Excel to Datatable gives error "Too many fields"
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 开发者_如何学CAs 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
精彩评论