Calling for database error

Bob Sneidar bobs at twft.com
Mon Jul 9 12:46:55 EDT 2012


Another technique is to wrap your call in a try catch statement like so:

try
  revExecuteSQL tDBID,tSQL
catch theError
  answer "There was an error accessing the database" & cr & theError with "Cancel" or "Continue"
  if the result is "Cancel" then exit to top
end try

Bob

  
On Jul 7, 2012, at 2:25 AM, Malte Brill wrote:

> Hi Skip (and welcome to liveCode from me too...)
> 
> If you want to check if there was an error in the SQL statement you tried to execute, you will want to check "the result"
> 
> revExecuteSQL tDBID,tSQL
> if the result is not a number then
>  -- an error occurred
>  answer the result & cr & tSQL
> end if
> 
> The result is quite often your friend. The other friend you will stumble upon sooner or later is the variable "it". Makes sense to check those two.
> 
> Hope that helps,
> 
> Malte
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list