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)
 help with paging?
 New Topic  Topic Locked
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 24 August 2007 :  02:45:50  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
I need to add paging to a page I'm doing. I got a link with example code from Zuel yesterday but can't really get a grip on how to add it to my code. I need to have a new page after every 20 hits.
Can anyone help me with this?

The code is here: http://www.gotlandrace.se/tabort/kommande_info.txt


/Tribaliztic
- www.gotlandrace.se -

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 26 August 2007 :  16:27:39  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
no paging-experts out there? =)
The code in the link above is the page I need to add paging to, I've tried myself but I'm stuck...

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 27 August 2007 :  10:33:45  Show Profile  Visit MarcelG's Homepage
Tribaliztic, I think you may find a good example of how paging can work when you have a look at the paging function used in topic.asp of Snitz.
If I'm not mistaking it's all in there for SQL and MySQL, using strPageSize as variable, and the mypage querystring.

Here's a good short tutorial by the way ; http://www.stardeveloper.com/articles/display.html?article=2000071001&page=1

portfolio - linkshrinker - oxle - twitter

Edited by - MarcelG on 27 August 2007 10:34:37
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 28 August 2007 :  02:14:48  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
Thanks Marcel, I've had a look at topic.asp already but can't really make any sense out of it. Can you point me in the right direction regarding what lines I should look at?

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 28 August 2007 :  06:27:10  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
Ok, so I got the testpage from that tutorial working but I have NO idea how to insert the existing code into this...
The code opens a table and then display it onto the page with paging. But how do I make it understand that it's data from a datalayer (or whatever it's called =))?
Now I just do this: "Collection = DataLayer.GetFutureArticleList()" and then use the data in that...
I'm new to both datalayers and paging so it's a bad match...

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

MarcelG
Retired Support Moderator

Netherlands
2625 Posts

Posted - 29 August 2007 :  03:44:38  Show Profile  Visit MarcelG's Homepage
ehm....sorry, without spending a lot of time on it (which I don't have, seeing my work piled up during my holiday), I have no idea either. Sorry....

portfolio - linkshrinker - oxle - twitter

Edited by - MarcelG on 29 August 2007 03:45:11
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 August 2007 :  04:13:31  Show Profile  Send ruirib a Yahoo! Message
Using a data layer seems too much for a beginning article on ASP paging.

This one seems simpler: http://www.dotnetindex.com/read.asp?articleID=40

With it and the Snitz code, you should be good to go.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 29 August 2007 :  04:23:51  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
Do I just replace the line "SQL = "SELECT productID, productName FROM products"" with my datalayer-stuff?
It's this part I don't understand, how do I get the paging-code to read my datalayer? =)

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 August 2007 :  04:52:40  Show Profile  Send ruirib a Yahoo! Message
Oh, that's the issue... you're using a data layer yourself...

Well the SQL needs to be your own SQL. Now, on how to change your data layer, that's different issue altogether. I guess you will need a method to retrieve a given page from a recordset, but I'm just wild guessing, cause I really don't know it.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 29 August 2007 :  06:11:46  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
Sorry if I'm confusing you, I'm pretty confused myself atm =)

I have high hopes that Zuel finds the time to help me since he helped me understand datalayers, but he's a buzy man I'm afraid. Anyone else know how to do this?

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 August 2007 :  06:29:25  Show Profile  Send ruirib a Yahoo! Message
A data layer is just a way of organizing code, so that the DB access code is concentrated there, instead of being spread through all the application pages. The Snitz .net version uses that approach. There is nothing much to it, conceptually, but you need to know the implementation details.

I would guess that adding paging to it may be a bit work, but as I said before, I really don't know your data layer.


Snitz 3.4 Readme | Like the support? Support Snitz too
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 29 August 2007 :  06:34:01  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
This is the function:

Public Function GetArticleList()
VerifyConnection()

m_strSQL = "SELECT AUKTION_ID, A_STATUS, A_RUBRIK, A_TEXT, PAGE_HITS FROM AUKTION WHERE AUKTION_ID= " & ID & ""

Call m_RecordSet.Open(m_strSQL, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText)

Select Case (m_RecordSet.RecordCount - 1 < 0)
Case True: GetArticleList = Empty
Case Else: GetArticleList = m_RecordSet.GetRows()
End Select
Exit Function
End Function

Should I add the paging into that code or the other way around? =)

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

Zuel
Average Member

USA
540 Posts

Posted - 29 August 2007 :  09:40:37  Show Profile  Visit Zuel's Homepage
quote:
Originally posted by tribaliztic

This is the function:

Public Function GetArticleList()
VerifyConnection()

m_strSQL = "SELECT AUKTION_ID, A_STATUS, A_RUBRIK, A_TEXT, PAGE_HITS FROM AUKTION WHERE AUKTION_ID= " & ID & ""

Call m_RecordSet.Open(m_strSQL, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText)

Select Case (m_RecordSet.RecordCount - 1 < 0)
Case True: GetArticleList = Empty
Case Else: GetArticleList = m_RecordSet.GetRows()
End Select
Exit Function
End Function

Should I add the paging into that code or the other way around? =)




Find me online today. Also put the file in our sharing folder.

My Completed Mods: News Mod | Zuel's Avatar Add-on
In Development: World of Warcraft Member Roster | [C# Based Forum]

Note - I may take a few days to recieve your email. Hotmail filters all new emails as junk. Would be best to post all questions, concerns in a forum topic to catch my immediate attention. This way others can assist and also correct any similar mistakes.

MSN / E-Mail: ucyimDa_Ruler@Hotmail.com

Personal Bookmarks: How to work a DBS File
Go to Top of Page

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 15 September 2007 :  14:03:36  Show Profile  Visit MaD2ko0l's Homepage
hey tribaliztic

did u get it all sorted in the end??

© 1999-2010 MaD2ko0l
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 16 September 2007 :  02:15:47  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
Zuel is helping me, we seem to miss eachother online all the time though =)

/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page

tribaliztic
Senior Member

Sweden
1532 Posts

Posted - 25 September 2007 :  08:29:52  Show Profile  Visit tribaliztic's Homepage  Send tribaliztic an ICQ Message
The info is displayed, but not divided into pages... Any hints?

This is the datalayer code:

Public Function GetItemList2()
VerifyConnection()
m_RecordSet.PageSize = 5
m_RecordSet.CacheSize = 5
m_RecordSet.CursorLocation = adUseClient

m_strSQL = "SELECT ITEM_ID, I_AUKTIONID, I_RUBRIK, I_TEXT, I_UTROP, I_****PRIS, PAGE_HITS FROM item WHERE I_AUKTIONID= " & ID & " ORDER BY I_RUBRIK"
Call m_RecordSet.Open(m_strSQL, my_Conn, adOpenForwardOnly, adLockReadOnly, adCmdText)


Select Case(Len(Request.QueryString(page)) = 0)
Case True: m_RecordSet.AbsolutePage = 1
Case Else:
Select Case (CLong(Request.QueryString(page)) <= m_RecordSet.PageCount)
Case True: m_RecordSet.AbsolutePage = CLng(Request.QueryString(page))
Case Else: m_RecordSet.AbsolutePage = 1
End Select
End Select

Select Case (m_RecordSet.RecordCount - 1 < 0)
Case True: GetItemList2 = Empty
Case Else: GetItemList2 = m_RecordSet.GetRows()
End Select
Exit Function
End Function


Can anyone see why it's not being divided into pages? Do you need more info?


/Tribaliztic
- www.gotlandrace.se -
Go to Top of Page
Page: of 2 Previous Topic Topic Next Topic  
Next Page
 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 1.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07