|
Post by benjamin1 on Jan 22, 2008 20:11:09 GMT -5
hi,
when i run this code i get an error from RB. The error reads 'Runtime Error in program 'nrcomm': if #mySQLdb hasanswer() thenMessage not understood: #atEnd'
any help on this i would appreciate.
here is the code
'-------------------------------------------------------- dim rid$(1000) rcnt$="" done=1
while done=1 [getin] input "RID?(<Enter> to quit)";trid$ if trid$="" then done=0 else sqliteconnect #mySQLdb, "nrcomm.db"
query$ = "select * from inventory where rid = '"+trid$+"'" if #mySQLdb hasanswer() then rcnt=rcnt+1 rid$(rcnt)=trid$ #mySQLdb disconnect()
else #mySQLdb disconnect() print "Receiver not in inventory." goto [getin] end if end if wend '---------------------------------------------------------------------
link #saverid, "Save and Print", [saveandprint] html "<br>" link #restartrid, "Restart", [restart]
wait
|
|
|
Post by Jerry Muelver on Jan 22, 2008 20:52:57 GMT -5
This is from Building Blocks shown in the Run BASIC Programming Manual: 'create file accessor to see if database file exists files #a, "mydata.db" 'check for existence exists = #a hasAnswer() 'if database doesn't exist, create it if not(exists) then sqliteconnect #s, "mydata.db" query$ = "create table Members (name char(50) default 'N/A', country char(24) default 'N/A', rank char(16) default 'N/A')" #s execute(query$) #s disconnect() end if
instead of if #mySQLdb hasanswer() then
try exists = #mySQLdb hasanswer() if exists then
|
|
|
Post by carlgundel on Jan 22, 2008 21:02:57 GMT -5
Hmm. I'm surprised we haven't seen that one until now.
-Carl
|
|
|
Post by benjamin1 on Jan 22, 2008 22:37:04 GMT -5
hi, yes, i didn't know i couldn't do that, but it seems to work! My real error was that I forgot to add the execute query line of code. Once I added that it all worked out fine. I'm at peace for now. thanks.
|
|
|
Post by carlgundel on Jan 22, 2008 22:48:46 GMT -5
hi, yes, i didn't know i couldn't do that, but it seems to work! My real error was that I forgot to add the execute query line of code. Once I added that it all worked out fine. I'm at peace for now. thanks. Glad to hear it. :-) -Carl
|
|