iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > Classic ASP

Reply
 
LinkBack Thread Tools
Old February 16th, 2009, 10:13 AM   #1
New Member
 

Join Date: Feb 2009
Location: Sri Lanka
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 iahamed is on a distinguished road
ASP MySQL ODBC Paging working error with SQL Statement.

Hi I am using ASP and MySQL with ODBC without DSN connection great stuff using pure MySQL ODBC Driver code with Asp works Brilliant.

I sorted the paging with MySQL. However One querry of mine is not letting it page through record sets. Can Someone tell me how to have the querry that will suport the MySQL ODBC ASP way please?


These query's work.

. SQL = SQL & " SELECT * FROM listing ORDER BY ID DESC;"

. strSQL = strSQL & " ORDER BY ID,DBName,DBposition,DBsalary,DBage,Description DESC;"


This is the query that works but "docent page", this calling a Sub category:

Please help me to resolve this:

. SQL = SQL & " SELECT * FROM listing WHERE (Country = '" & mCountry & "' ) AND (Classification = '" & mDetails & "') ORDER BY ID DESC;"


This is my Code:


<%
Dim RS
Dim SQL
Dim adoCon1
Dim strEmail
Dim testv
Dim test1
Dim intRecordspp
Dim intTotalRecords
Dim intTotalPages
Dim intPageNum
Dim strBlah1
Dim strBlah2

Dim mDetails
Dim mCountry

mCountry=request.QueryString("Country")
mDetails=Trim(request.querystring("Details"))


If Request.QueryString("rpp") = "" Then
'No of Records to Display
intRecordspp = 1
Else
intRecordspp = CInt(Request.QueryString("rpp"))
End If

If Request.QueryString("PageNumber") = "" Then
intPageNum = 1
Else
intPageNum = CInt(Request.QueryString("PageNumber"))
End If


Dim connect_string
set connect_string = server.createObject("ADODB.connection")

Set RS = Server.CreateObject("ADODB.Recordset")
RS.cursorlocation = 3

connect_string.Open "Driver={MySQL ODBC 5.1 Driver}; Server=localhost;Database=DBname;UID=root;PWD=pw4"

SQL = SQL & " SELECT * FROM listing WHERE (Country = '" & mCountry & "' ) AND (Classification = '" & mDetails & "') ORDER BY ID DESC;"

RS.CursorType = 3
RS.Open SQL, connect_string
RS.PageSize = intRecordspp

If NOT RS.EOF Then RS.AbsolutePage = intPageNum
intTotalRecords = RS.RecordCount
intTotalPages = RS.PageCount

%>

<%
' If RS.EOF Then
%>
<!-- No Records-->
<%
' connect_string.close
' Response.End
'End If


' Collect Results now
%>

Page <%= intPageNum%> of <%= intTotalPages%>
<BR>

<%
If intPageNum = 1 Then
Else %>
<A HREF="listing.asp?PageNumber=<%= intPageNum -1%>&rpp=<%= Request.QueryString("rpp")%>">Back</A>
<%
End If
%>

<% If intPageNum < intTotalPages Then %>
<A HREF="listing.asp?PageNumber=<%= intPageNum +1%>&rpp=<%= Request.QueryString("rpp")%>">Next</A>

<%
Else
End If

' EOF 3 Paging----------------------------------------

for strBlah2 = 1 to intRecordspp
if Not RS.EOF Then
%>

the then Db Fields.


The DB fields are working fine. The only this is with the query. Can some one help me with the query, as to how to put it work with ASP and MySQL with ODBC?
iahamed is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old February 17th, 2009, 05:49 AM   #2
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,629
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: ASP MySQL ODBC Paging working error with SQL Statement.

I can't understand what you mean. Could you please describe them again
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old February 17th, 2009, 11:42 AM   #3
New Member
 

Join Date: Feb 2009
Location: Sri Lanka
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 iahamed is on a distinguished road
ASP MySQL ODBC Paging working error with SQL Statement.

Hi Monie,

Thank you for the atemp made to Help. I am Using ASP MySQL and ODBC. I am through my query caling a Sub category. Paging is working with these SQL statements:

. SQL = SQL & " SELECT * FROM listing ORDER BY ID DESC;"

. strSQL = strSQL & " ORDER BY ID,DBName,DBposition,DBsalary,DBage,Description DESC;"

Paging Dosent hapen when Say:

. SQL = SQL & " SELECT * FROM listing WHERE (Country = '" & mCountry & "' ) AND (Classification = '" & mDetails & "') ORDER BY ID DESC;"

That's the One I need now to Fix, I know the way of SQL when it comes to MySQL is diferent that Access and Ms SQL. My Question is Monie, how should I to make the SQL work with Paging make it work

. SQL = SQL & " SELECT * FROM listing WHERE (Country = '" & mCountry & "' ) AND (Classification = '" & mDetails & "') ORDER BY ID DESC;"

(Country = '" & mCountry & "' ) AND (Classification = '" & mDetails & "') That part wokrs In Access and pages through the records. In MySQL It dosent. Any Style to do it?

DO I have to add a Limit etc....? Please Help me. Thank you.
iahamed is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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
ODBC connection error (MS Access) fouraces Databases 1 February 26th, 2009 10:14 AM
php mysql select statement. ljackson84 PHP 10 September 22nd, 2008 11:19 AM
Help with an IF Else statement & MySQL Jack Franklin PHP 5 January 18th, 2008 05:08 PM
Working fine but giving error clickme_not JavaScript 3 April 28th, 2006 03:36 PM
'ODBC'@'localhost' error Sqrlgrl Databases 8 November 21st, 2005 10:27 AM


Search Engine Optimization by vBSEO 3.2.0 RC8