>Hi,
>
>This is probably pretty simple. I've written a MS SQL Server 7.0 stored procedure that has a return @@rowcount at the end.
>
>I execute the stored procedure using:
>
>y = sqlexec(1,'sp_calculate')
>
>I thought the rowcount of rows affected would be brought back to vfp cursor sqlresult. I used the sql debuggerer in VB to confirm that @@rowcount has a value. But no VFP cursor is created.
>
>Any ideas??
If you are creating a record set in your stored procedure, the record set will be in SqlResult, provided the SQLEXEC returns 1, so you need to makes sure y = 1 in the above statement.
If successful, you can check the @@ROWCOUNT in VFP indirectly with:
RECCOUNT( "SqlResult" )
You can also pass back @@ROWCOUNT via an OUTPUT parameter in your stored procedure:
CREATE SPROC sp_Calculate
@RowCnt integer OUTPUT
AS
SELECT * FROM TableName
@RowCnt = @@ROWCOUNT
RETURN 0
Then your SQLEXEC becomes:
LOCAL lnRowCount
lnRowCount = 0
IF SQLEXEC(1,'sp_calculate ?@lnRowCount') = 1
ENDIF
Chris McCandless
Red Sky Software