开发者

Selecting Data from Excel Spreadsheet Doesn't get First Row

开发者 https://www.devze.com 2023-03-06 07:47 出处:网络
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?

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

精彩评论

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