View Full Version : What's the equivalent command in asp of mysql_numrows?
Hi all,
Is there in asp a command such mysql_numrows() of php?
Thanks,
ddz
fractalvibes
12-18-2004, 02:46 AM
Say if your recordset is a variable called rs, then the equivalent is
recs = rs.RecordCount
fv
oracleguy
12-18-2004, 06:55 AM
If, when using that property you keep getting a -1 as the value, check this link out: http://www.asp101.com/samples/db_count.asp
If, when using that property you keep getting a -1 as the value, check this link out: http://www.asp101.com/samples/db_count.asp
Hi, thanks for the answer.
I read the article you suggested me and I have another doubt:
I will execute this sql query:
SELECT COUNT(field_name) FROM table_name;
But how can I put the result of this sql query into a variable in asp?
Thanks again,
ddz
fractalvibes
12-20-2004, 04:45 AM
Execute this and get back a recordset:
SELECT COUNT(field_name) AS MyCount FROM table_name
Address this as
yourRecordsetVar("MyCount")
fv
Execute this and get back a recordset:
SELECT COUNT(field_name) AS MyCount FROM table_name
Address this as
yourRecordsetVar("MyCount")
fv
Yep thanks, it works fine.
But it is possible to treat that "yourrecordsetvar("MyCount")" as an integer because I would like to make some math operations with it?
c = yourRecordsetVar("MyCount")
if c < 3 then
....
end if
I got an error and it tells me that: Microsoft VBScript (0x800A000D) - Type mismatch on the if - condition line...
ddz
Yep thanks, it works fine.
But it is possible to treat that "yourrecordsetvar("MyCount")" as an integer because I would like to make some math operations with it?
c = yourRecordsetVar("MyCount")
if c < 3 then
....
end if
I got an error and it tells me that: Microsoft VBScript (0x800A000D) - Type mismatch on the if - condition line...
ddz
Stupid question: I transformed the string into an integer:
c1 = cint(c)
and then I use c1 as int to do my math operations...
Thanks guys again,
ddz
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.