sql reader question

Ricky D

Well-Known Member
Licensed User
Longtime User
Hi people,

in my Taxi app I use a reader to access data from my SQLite database.

Is there a way to tell if the reader is open? I run into this error

Cannot set CommandText when a DataReader is active

I'd like to do something like

If reader.IsOpen=true Then reader.Close

before I try to set the command's CommandText method.

Is there a way to tell if the reader is open?

If not should I use reader.Dispose to get rid of it and then use reader.New1 when i need to use the reader?

any help appreciated.

regards, Ricky

Edit: tried doing .Dispose then when I need it use .New1. Here is my code

ErrorLabel(frmShifts_Show_Error1)
retry:
reader.Value=cmd.ExecuteReader
.
. other code
.
Return

frmShifts_Show_Error1:
reader.New1
Goto retry


I find the code at .New1 keeps getting executed once the 1st error is trapped
Any ideas?
 
Last edited:

Ricky D

Well-Known Member
Licensed User
Longtime User
Thanks Erel

Thanks Erel.

That works just right

regards, Ricky
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…