Database Connection Status Check
Posted: Tue Feb 16, 2010 2:04 pm
Hi All,
Help please to get my head around this...
Need to test database connection status prior to inserting/updating content.
I have the following code in a test button.
First stepping into the if statement while a connection exists is ok, but, I am knocking this connection out in code
to simulate a failure after the fact of the initial test. Doing this however results in the subsequent database task failing. I was hopping that the routine "handleRevDBerror the result" would have picked the error but code execution doesnt reach here since the debug already bombs out at the point. Any ideas on how I should be approaching this?
kotikoti.
Help please to get my head around this...
Need to test database connection status prior to inserting/updating content.
I have the following code in a test button.
Code: Select all
on mouseUp
/* --------------------------------
Test for DB connection
--------------------------------- */
if revopenDatabases() <> empty then
wait 1 sec
revclosedatabase gConID
wait 1 sec
#run SQL
put empty into dbError
put "select noteddID from Notes" into tSQL
put revQueryDatabase(gConID,tSQL) into rsID
handleRevDBerror the result
if number of words of dbError = 1 then
put "# of records in Notes:" && revNumberOfRecords(rsID) into fld "tDatabase"
put the result into tResult
handleRevDBerror tResult
else
put "resource id of open dbs:" && revopenDatabases() &cr&cr& dbError into fld "tDatabase"
end if
else
answer "No Database is open"
exit mouseUp
end if
end mouseUp
Code: Select all
wait 1 sec
revclosedatabase gConID
wait 1 sec
Code: Select all
put revQueryDatabase(gConID,tSQL) into rsID
kotikoti.