[SOLVED] RecordCount in ASP-MySQL

This is a discussion on "[SOLVED] RecordCount in ASP-MySQL" within the Databases section. This forum, and the thread "[SOLVED] RecordCount in ASP-MySQL are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 31st, 2007, 07:48
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
[SOLVED] RecordCount in ASP-MySQL

I know how to do a RecordCount (count the total record in my database table) in MS Access, since I am new to MySQL, could anybody suggest me a better way than what I have found in the Internet? Thanks..

Here is the code that I am using right now:
Code: Select all
<%
    Dim connString, cp, conn, rec,count
    connString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=monieweb; OPTION=4; UID=root; PASSWORD=monie;"
    Set conn = Server.CreateObject("ADODB.Connection")
    Set cp=Server.CreateObject("ADODB.Recordset") 
    conn.Open(connString)
    Set cp = conn.Execute("SELECT * FROM userlogin")
%>
<%    
    'RecordCount
    Dim intRows
    Function RecCount(cp)
    intRows = cp.GetRows
    cp.MoveFirst
    RecCount = UBound(intRows,2) + 1
    End Function 
%>

<body>
<% Response.Write (" Total Record: " & RecCount(cp) & "")%>
</body>
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)

Last edited by Monie; Oct 31st, 2007 at 07:54.
Reply With Quote

  #2 (permalink)  
Old Nov 1st, 2007, 06:59
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: RecordCount in ASP-MySQL

Found a better way to do it:
  • rsCount is your recordset
HTML: Select all
Dim count, totalUser
While Not rsCount.EOF
count = count + 1
rsCount.MoveNext
Wend
    
totalUser = count

<%Response.Write("Total User : " & totalUser & "")%>
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)

Last edited by Monie; Nov 1st, 2007 at 07:04.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] do I need mysql set up on my computer? Oak Databases 7 Jan 18th, 2008 14:27
[SOLVED] XML &gt; MySQL? alexgeek PHP Forum 13 Jan 5th, 2008 10:45
[SOLVED] Connecting/Using MySQL and ASP Monie Classic ASP 8 Oct 12th, 2007 09:00
[SOLVED] MySQL to MSSQL Anonymous User Databases 7 Oct 6th, 2003 07:48


All times are GMT. The time now is 07:48.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43