Originally Posted by
norminator
Is there any way with a .NET DataReader to tell when you are working with the last record? Something like EOF in classic ASP.
NEED URGENT HELP!
try something like this:
Code:
querycount = "SELECT COUNT(primary_key) AS RecordCount FROM table1;"
com.commandText=querycount
reader = com.ExecuteReader()
Dim recordcount as integer
recordcount = reader("RecordCount")
reader.close
myquery="SELECT * FROM table1"
com.commandText=myquery
reader = com.ExecuteReader()
mycount=0
do while reader.read
if mycount=recordcount then
msgbox "Last record Reached"
end if
mycount=mycount+1
loop
Last edited by Arch_Angel; Aug 10, 2007 at 09:32 AM.
Reason: added CODE tags
Code King aka Code WizZzard: Motivated By The Challenge, Driven By The Will To Succeed.
In The Land Of Programmers, The Code WizZzard Is KING. Sen on anything VB