Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    ddz
    ddz is offline
    New Coder
    Join Date
    Sep 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    Texas
    Posts
    287
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Say if your recordset is a variable called rs, then the equivalent is

    recs = rs.RecordCount

    fv

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    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
    OracleGuy

  • #4
    ddz
    ddz is offline
    New Coder
    Join Date
    Sep 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oracleguy
    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

  • #5
    Regular Coder
    Join Date
    Aug 2002
    Location
    Texas
    Posts
    287
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Execute this and get back a recordset:

    SELECT COUNT(field_name) AS MyCount FROM table_name

    Address this as
    yourRecordsetVar("MyCount")

    fv

  • #6
    ddz
    ddz is offline
    New Coder
    Join Date
    Sep 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by fractalvibes
    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

  • #7
    ddz
    ddz is offline
    New Coder
    Join Date
    Sep 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by 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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •