Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 paging thru records
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

redbrad0
Advanced Member

USA
3725 Posts

Posted - 07 April 2002 :  14:17:29  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
i am trying to write a sql statment and I am having a hard time doing it, so I am wondering if someone can help. Here is what I am trying to do.....

1. List all records on a page going down (DONE).
2. The user can sort the list by any of the columns (DONE)
3. The user can click on any of the items to view the details about that item (DONE)
4. There would be a next and previous button that would take them to the correct record in the database. This would be the next record in line on which ever way they sorted it. (NEED HELP)

So number 4 is what I do not know how to do. I know it would probley have to be paging, with the page size set at one. But I dont know how to tell it what record to start with. Any ideas?

Brad
Web Hosting with SQL Server @ $24.95 per month

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 07 April 2002 :  15:45:27  Show Profile
This article discusses paging N records at a time. It might help.

You could also create a delimited string ordered the records in the selected sort order. Then pass that string value along with the record id they chose in step 3. Then parse the string to find the current record and subsequently get the previous and next record ids.

Nikkol
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 07 April 2002 :  23:20:59  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
thanks for that article, but i can do regular paging. you can see what i want to do when you click on the subject of any of these messages on this page...

http://www.buddyconnections.com/new/messages/inbox.asp

excuse the site layout, its just a joke

So when you view the Private Message I want it to allow you to click on next or previous message. What I am thinking is I can set the page size to 1, set all the same sql information, and if i can just tell it which page to start off with, then ill be in good shape.

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

Bunce
New Member

Australia
84 Posts

Posted - 08 April 2002 :  00:48:12  Show Profile  Send Bunce an ICQ Message
How about retrieving the ID of the previous and next records in the initial query. You could then use that in the querystring of the next call.

Cheers,

Andrew

======================================================
There have been many, many forum posts made throughout the world...
This was one of them!
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 08 April 2002 :  01:02:11  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
that would work, but what if they want to click next 10 times till they have read all their messages?

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 08 April 2002 :  07:02:13  Show Profile
Try using GetRows. Since you are passing the sort order through the query string, you can execute an sql to return a recordset of the message ids. Turn the recordset into an array using getrows. Find the index current message being viewed (i). Then the previous is i-1 and next is i+1.

Nikkol
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 08 April 2002 :  09:38:42  Show Profile  Visit Gremlin's Homepage
Copy the code from topic.asp that does the next message/previous message stuff ?

Failing that just use a querystring variable say "offset" save it using an hidden field type on the page, and if the user clicks next then increment by 1 and index into your recordset by the new value of "offset" likewise for going backwards just subtract 1

www.daoc-halo.com
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 08 April 2002 :  15:28:13  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
thanks gremlin, i will look at that code to see if it will give me an idea. i forgot all about that paging.

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 08 April 2002 :  17:32:31  Show Profile
Where is the next/previous in topic.asp? I don't see it.

Nikkol
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 08 April 2002 :  17:54:17  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
if you are viewing this topic the its at the very top where it says topic. it was have an arrow to the right, and if a new topic gets posted then the arrow to the left will be posted.

i was looking at the way this code was written and it would work IF it the columns could not be sorted by different fields. maybe i just cant think right now but if someone would like to see if they could get this to work then let me know and i will show you the code. otherwise i will put this off till the VERY end.

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 08 April 2002 :  20:50:47  Show Profile
Dang, you learn something new everyday. I think you might want to consider what I said about GetRows to include the sort order. Seems like that might be the way to go.

Nikkol
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 09 April 2002 :  01:26:25  Show Profile  Visit Gremlin's Homepage
GetRows will definately make it easier, dissconected recordsets could probably be used here also.

www.daoc-halo.com
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 09 April 2002 :  15:41:45  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
well the problem is i really dont know much about the getrows function. If you want to view what this is going on then look at...

http://www.buddyconnections.com/new/messages/mailbox.asp

you can do anything you want on this PM, because i will just run the setup.asp file i made and return everything back to normal. i think the only things i have left is to do the next and prev message buttons, and then format the text when its inserted and displayed so you can insert ' and it will keep the formating with the way you entered it. what do yall think?

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 09 April 2002 :  15:47:22  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
oh by the way, i know it looks just like hotmail. i liked all the functions of hotmail and then as i stated in another topic, me and roland were joking around and so i put the hotmail icons at the top to make it look exactly like it.

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page

snaayk
Senior Member

USA
1061 Posts

Posted - 09 April 2002 :  15:55:07  Show Profile  Visit snaayk's Homepage  Send snaayk an AOL message  Send snaayk an ICQ Message  Send snaayk a Yahoo! Message
looks like Hotmail Looks nice, will this be a MOD, just curious, or a personal MOD?

Go to Top of Page

redbrad0
Advanced Member

USA
3725 Posts

Posted - 09 April 2002 :  16:10:53  Show Profile  Visit redbrad0's Homepage  Send redbrad0 an AOL message
well its going on one of my personal sites (buddyconnections.com) which is not going to have a forum (well at least at this point). so the code is not written or using anything with snitz, so it might be hard for someone to convert it over. but i have put some great features in it that does not come with the PM Mod here at Snitz.

I think this one might run a little better also, but who knows, only time will tell.

Brad
Web Hosting with SQL Server @ $24.95 per month
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000 Version 3.4.07