Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

sql reader question

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-16-2008, 08:08 AM
Basic4ppc Veteran
 
Join Date: Sep 2008
Location: Brisbane, Australia
Posts: 317
Default sql reader question

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 by Ricky D : 09-16-2008 at 08:22 AM. Reason: umm... .dispose not quite working
Reply With Quote
  #2 (permalink)  
Old 09-16-2008, 05:18 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,726
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

After you set the reader's value once you can close it even after it's closed.
IsNull(reader.value) will return true before you set the reader's value for the first time.

Something like this should solve your problem:
Code:
If IsNull(reader.value) = false then reader.close
cmd.CommandText = ...
Reply With Quote
  #3 (permalink)  
Old 09-17-2008, 06:25 AM
Basic4ppc Veteran
 
Join Date: Sep 2008
Location: Brisbane, Australia
Posts: 317
Thumbs up Thanks Erel

Thanks Erel.

That works just right

regards, Ricky
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
simple chm reader Cableguy Chit Chat 5 05-19-2008 03:40 PM
bible reader lavcastillo Questions (Windows Mobile) 6 01-31-2008 11:58 AM
SQL Reader BPak Basic4ppc Wishlist 0 01-26-2008 11:05 PM
Help file "CHM" Reader (3rd Party Freeware) hmeyer Code Samples & Tips 4 10-03-2007 11:22 AM


All times are GMT. The time now is 02:23 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0