Current location: Hot Scripts Forums » Programming Languages » ASP » paging recordset not displaying the data


paging recordset not displaying the data

Reply
  #1 (permalink)  
Old 08-04-04, 07:16 PM
lulu lulu is offline
New Member
 
Join Date: Aug 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Red face paging recordset not displaying the data

Hi,

I am working on paging a recordset by using MSQL database.

for some reason it wont display the selected records. It will only
display the records from the first page.

for example:

Page 1 2 3 4 previous next

It will display the data on page 1 but if I click on 2 on page 2 it will say no records found.

if I say: SQL = "SELECT * FROM mid"
then I am able to go from page 1 to page 4 but

if I say: SQL = "SELECT * FROM mid where seeking = '"&request("seeking")&"'"
then I can see the record displayed on page 1 but on page 2 thru 4 it would
say Sorry, There is no result.

I don't know what to do please help.

thanks:
here's my code.

<%@ LANGUAGE = "VBScript" %>
<%
Option Explicit


Dim seeking

seeking = request.form("seeking")


Dim strCon, oCon, pages, Rec, DisplayNum, i, page, SQL, ipage, z
strCon = "DRIVER={MySQL ODBC 3.51 Driver};SERVER= ;DATABASE= ;UID= ;PWD= ;OPTION=3"
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adUseClient = 3
Const adCmdText = 1



page = request.querystring("page")
If page = "" Then
page = 1
else
page = cint(page)
End If

DisplayNum = 0

Set oCon = Server.CreateObject ("ADODB.Connection")
Set Rec = Server.CreateObject ("ADODB.Recordset")

oCon.Open strCon
Rec.PageSize = 2
Rec.CursorLocation = adUseClient




' SQL="SELECT * FROM mid"

SQL = "SELECT * FROM mid where seeking = '"&request("seeking")&"'"


Rec.Open SQL, oCon

if Rec.EOF OR Rec.BOF Then
response.write "<br><br>"

response.write "<p align=center><b>Sorry, There is no result ... </b></p>"
else

ipage = Rec.PageCount

if page = 0 or page > ipage Then
Rec.AbsolutePage = ipage
else
Rec.AbsolutePage = page
end if

Do While Not Rec.EOF AND DisplayNum < Rec.PageSize

response.write "<font style=""font-size=12px; font-family : verdana"">" & Rec("relationship") &"&nbsp;&nbsp;"
response.write Rec("seeking") & "</font><br>"

DisplayNum = DisplayNum + 1
Rec.MoveNext
Loop

end if

If ipage > 1 Then
response.write "<p align=center>"
pages = "<b>Pages : &nbsp;"

For z = 1 to ipage
If z = page then
pages = pages & page & " "
Else
pages = pages & " <a href=?page=" & z & ">" & z & "</a>" & " "
End If
Next
response.write pages & "&nbsp;&nbsp;"
End If

if ipage > 1 And page > 1 Then
response.write "<a href=?page="& page - 1 &">Previous</a>"
end if

response.write "&nbsp;&nbsp;"
If ipage > 1 And page < ipage Then
response.write "<a href=?page="& page + 1 &">Next Page</a>"
end if

response.write "</b></p>"
Rec.Close
oCon.Close
set Rec = nothing
set oCon = nothing

%>


Thanks,
lulu
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help displaying data Damith Windows .NET Programming 2 01-14-05 04:48 PM
Displaying last few characters of data Reg PHP 6 07-02-04 03:42 PM
Displaying data based on a field in a csv file Fladrif PHP 5 03-06-04 05:02 PM
Displaying Selected Table Data from MYSQL using ? in URL jason.lafferty PHP 4 01-21-04 11:28 AM


All times are GMT -5. The time now is 09:02 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.