Click to See Complete Forum and Search --> : getting number of affected rows


Ali Imran
06-12-2005, 07:31 AM
Is there any function in ASP through which we can obtain the number of affected rows? as in php we use something link mysql_affected_rows

Or please let me know the sql query which can return me the affected rows.

An urgent reply is highly appreciated.

regards

buntine
06-12-2005, 09:17 AM
The RecordSet object has a property named RecordCount that returns the number of records returned in a query.

yourRecordSetObject.RecordCount

For queries that do not return a recordSet (such as a DELETE or UPDATE), you can provide a variable into which the number of affected records will be stored.

Dim intRecsAffected
yourConnectionObject.Execute SqlQuery, intRecsAffected

Regards.

phpnovice
06-12-2005, 09:18 AM
http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthcmdexecute.asp

rrhodes
06-13-2005, 10:04 AM
When using "RecordCount", sometimes your "cursor type" and/or the backend DB being used will cause this not to return meaningful info - so, test and possibly change your cursor type settings if you don't get back any info.

phpnovice
06-13-2005, 10:30 AM
... you can provide a variable into which the number of affected records will be stored.

Dim intRecsAffected
yourConnectionObject.Execute SqlQuery, intRecsAffected

You got your arguments reversed:

http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthcmdexecute.asp

buntine
06-13-2005, 07:10 PM
Nar, you got your objects confused.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcmdexecute.asp

phpnovice
06-13-2005, 11:49 PM
You posted the same link I did. I guess you meant to post this one:

http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthcnnexecute.asp

buntine
06-14-2005, 01:52 AM
Yeah. So I got my hyperlinks reversed, instead. :p