Selecting Data from Excel Spreadsheet Doesn't get First Row
I'm using an OleDbDataReader to loop through my imported excel file and it gets everything in the file except for the first row. How can I specify that I want to see this header row?
strSQL = "SELECT * FROM [" & firstSheetName & "]"
Dim myCommand As New OleDbCommand(strSQL, myConnection)
Dim myDba As OleDbDataReader
myDba = myCommand.ExecuteReader
s = ""
While myDba.Read()
For i = 0 To myDba.FieldCount - 开发者_JAVA百科1
s &= myDba.Item(i) & vbTab
Next
s &= vbCrLf
End While
You should specify that your spreadsheet doesn't have header: HDR=No .
精彩评论