RowCount

Does mysql support rowcount when using it in asp.I am trying to display every other reocrd displayed in my asp page indented.
LVL 8
thenoneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BogoJokerCommented:
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
0
thenoneAuthor Commented:
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
else
style = text:indent 0px
end if

Then I have my for loop in my table

0
BogoJokerCommented:
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
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

ikeworkCommented:
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 :)
ike
0
Austin_HastingsCommented:
select @rnum:=(@rnum+1)%2 AS parity, * from table
0
pradapkumarCommented:
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>

;-)

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

ike
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BogoJokerCommented:
And although its true pradapkumar, executing two querries would probably not be the best way to do this.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.