TKGhoul TKGhoul - 1 year ago 88
MySQL Question

Check if MySQLReader Finished Running/Finding Record VB.Net

I want to check if the

MySQLReader
is finished finding my Record.

So far this code helps me finding the record.

if reader.HasRows then
while reader.Read()
//codes
end while
else
//else condition codes
end if


I really want to know if the
Reader
finished running. Something like
reader.Finished()//**but there's no such thing like this code**
. Can someone help on this?

Answer Source

reader.Read() will return false when the Reader is finished reading. This will result in your while loop terminating. You can do something like this:

if reader.HasRows then
   while reader.Read()
       ''codes
   end while
   ''Do whatever it is you wanted to do when the reader is finished.
else
    ''else condition codes
end if