Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Parsing
Message
De
01/04/2021 18:52:13
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
01/04/2021 13:14:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01679440
Message ID:
01679456
Vues:
40
>>Hi Kevin
>>
>>In message # 01679403 I am trying to get SQL Server to execute a command via SPT and if the command fails, send an error to VFP.
>>
>>The app I inherited is doing SQLEXEC without any checking of return values. I am building a little ??sqlexec in which I will check and re-establish a broken connection, check and retry for busy connections. I was prompted to use a transaction around the existing query.
>>
>>Can you advise?
>>
>>Thanks
>>
>>Mike
>
>Mike
>
>I'm not sure if this will help, but this is a function that has been working for a long time in my apps.
>I only use SPT.
>
>
>
>*-- Execute SQL Command and display errors, if any
>PARAMETERS pc_ConnHandle
>PRIVATE ll_return, ln_exec,la_error
>ll_return = .T.
>ln_exec = SQLEXEC(pc_ConnHandle)
>IF ln_exec < 1
>  ll_return = .F.
>  WAIT WINDOW "SQL ERROR Has Occurred "
>  = AERROR(la_error)
>  WAIT WINDOW la_error(1,2)
>ENDIF
>RETURN ll_return
>
Hi Bill

If this is a bit of SQL, what do you get in your la_Error?
	BEGIN TRY
		BEGIN TRANSACTION
		SELECT 1/0;
		COMMIT TRANSACTION
	END TRY
	BEGIN CATCH
		ROLLBACK TRANSACTION;
		THROW;
	END CATCH
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform