开发者

How to Check If Recordset Row is Empty?

I am currently working on a classic ASP application extracting data from an excel sheet. Before this data is saved to the server, I validate first if the data has the required data populated.

Do Until myRecordSet.EOF
    ' Do processing here
    if Len(myRecordSet.Fields(0)) > 0 Then
            ' Something has to be done inside
    End if
    myRecordSet.MoveNext
Loop

I was able to handle this accordingly although I noticed an issue with the EOF property. Supposed my excel sheet have 50 rows populated accordingly, and then the user added 5 开发者_Go百科more rows but deleted it afterwards, the EOF property points to the end of the additional 5 more rows as EOF (instead that it will hit EOF at row 50, it will EOF at row 55). It would be tedious to exhaust all columns to check for the length if it's greater than 0 just to check if the current row is empty or not. Any leads to make checking much more easier?


If you have an ID field of some description or a reasonably small number of fields (columns), it should be possible to SELECT using a WHERE statement, even if you have a large number of fields (columns), it may be possible to say that certain fields are essential. Furthermore, it should not take all that long to run two statements, one with WHERE and one without and compare the record count.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜