Posted on 2006-04-08
Last Modified: 2008-02-01
Does mysql support rowcount when using it in asp.I am trying to display every other reocrd displayed in my asp page indented.
Question by:thenone
    LVL 17

    Assisted Solution

    Hi thenone,

    Since you have not yet gotten a comment I'll try to help you out.
    You could add an extra field COUNT(column_name) as num_rows, so it would look like:
    SELECT *, COUNT(column_name) as num_rows, FROM table

    Joe P
    LVL 8

    Author Comment

    you have tried to help me with this before I belive and I still can't get it to work because I am not sure if mysql supports it this way.

    rowcount = rowcount + 1

    if rowcount = 2 then
    rowcount = 0

    if rowcount = 0 then
    style = text:indent 10 px
    style = text:indent 0px
    end if

    Then I have my for loop in my table

    LVL 17

    Expert Comment

    In php, after the query I would just do:
    $numOfRows =  mysql_num_rows();
    Is there such a function in ASP?  To count the number of rows?
    This pulls the responsibility away from mysql and into ASP, is that okay?

    Joe P
    LVL 20

    Assisted Solution

    hi thenone,

    i guess you use an ado-recordset in your asp, to retreive the records, so after Recordset.Open you can retreive the recordcount with Recordset.RecordCount:

    Dim rst as new ADODB.Recordset
    Dim count as Long

    rst.Open "Select ..."
    count = rst.RecordCount

    hope it helps :)
    LVL 1

    Assisted Solution

    select @rnum:=(@rnum+1)%2 AS parity, * from table
    LVL 9

    Assisted Solution

    you can do it in two steps. LIke

    first execute this querry to get the no of rows

    SELECT COUNT(*) as num_rows, FROM table WHERE<your Condition>

    then execute ur querry normally

    SELECT *  FROM table WHERE<your Condition>


    LVL 20

    Accepted Solution

    hey guys, we dont need to reinvent the wheel .. ado-recordset-object has a method for that ...

    LVL 17

    Expert Comment

    And although its true pradapkumar, executing two querries would probably not be the best way to do this.

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Loading csv or delimited data files to MySQL database is a very common task frequently questioned about and almost every time LOAD DATA INFILE comes to the rescue. Here we will try to understand some of the very common scenarios for loading data …
    Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now