BTW, if the parameter to the stored procedure is truly an OUTPUT parameter, you'll have to prefix it with @ in order to catch the results
sErrorStr = ""
=SQLEXEC(nHandle,"EXEC usp_1 ?
@sErrorStr")
-Mike
>Hi,
>
>I am excuting a stored procedure of SQL2000 from VFP using SQLEXEC().
>
>This Stored Procedure (lets say usp_1) In turn calls another Stored (lets say usp_2)Procedure to Insert Records into the different Tables in a Database.
>
>sErrorStr = ""
>=SQLEXEC(nHandle,"EXEC usp_1 ?sErrorStr")
>
>Now usp_2 is passing a prameter (OUTPUT) to usp_1, which is the error number generated (if at all) by the insert statements (or 0 if none). I have used the @@ERROR immediately after every insert statements.
>usp_1 accepts this parameter passed by usp_2 and based on some logic passes the necessary output ( which is a string ) to VFP's output parameter
>
>What is happening is whenever there is a error in the usp_2 at the time of insert the whole procedure is terminated and the output of SQLEXEC() is -1.
>
>What i want is that it should return the error code to usp_1, which will then pass the necessary output to VFP's output parameter (sErrorStr).
>
>Please help...
>
>Kind Regards,
>KUMAR.