Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return @@rowcount
Message
 
To
07/01/2001 15:40:51
Paul De Niverville
Deniverville Econometric Research Ltd.
Victoria, British Columbia, Canada
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00460245
Message ID:
00460353
Views:
11
You may already know about this, but one thing to careful about with @@ROWCOUNT in SQL Server is that it may be reset after each T-SQL statement, like @@ERROR is. Just to be careful, after I execute a SELECT, INSERT, whatever, I:

SELECT @ErrorNo = @@ERROR, @RowCnt = @@ROWCOUNT

Then at the end of the sproc, I use @RowCnt rather than @@ROWCOUNT

>Hi,
>
>I had some problems with your second option, using @RowCnt integer OUTPUT
>ect.
>
>I'm able to get the row count into vfp by adding "select @@rowcount" at the end of the stored procedure and the result shows up in athe vfp cursor sqlresult.
>
>Thanks again for your suggestions.
>
>Paul
>
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform