开发者

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 .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜