473,326 Members | 2,076 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

move next link

229 100+
Hi, Anyone know the simplest solution to add a next record link.

I have this
Expand|Select|Wrap|Line Numbers
  1. <a href="page.asp?author=<%=rsCard("author")%>">link</a>
  2.  
I am on a page with one record and want a link to go to the next record on the same page and display that.
thanks in advance.

Richard
Oct 28 '07 #1
10 2685
shweta123
692 Expert 512MB
Hi,

Do you mean that you want to do pagination on your page?
Please refer this link Link

Hi, Anyone know the simplest solution to add a next record link.

I have this
Expand|Select|Wrap|Line Numbers
  1. <a href="page.asp?author=<%=rsCard("author")%>">link</a>
  2.  
I am on a page with one record and want a link to go to the next record on the same page and display that.
thanks in advance.

Richard
Oct 29 '07 #2
fran7
229 100+
Hi, Thanks for that good link, I will need that for something else later.
I am not sure what I need is called.

I have a dropdown list that the user can select from, up to 300 pages.
They are ordered alphabetically by name.
I was sort of thinking it would be good if each page, although dynamically produced from
the database, had a next link, that could then be used by the visitor to
go through all the records next, next, instead of having to go back to the dropdown.
The problem is I dont know how that link should be written so that it sends the visitor to the next.

The link I have is like this
Expand|Select|Wrap|Line Numbers
  1. <a href="page.asp?author=<%=rsCard("author")%>">link</a>
so I imagine the code would be saying that + 1 record

Thanks for any help.

Richard
Oct 31 '07 #3
shweta123
692 Expert 512MB
Hi,

I have one suggestion , get the names of next page and prevoius page on current page from database.

e.g on page1.asp you will write ,

<%
Dim sql
Dim rs
Dim con
Dim pageName
Dim prevPage
Dim nextPage

pageName = "page1.asp"

sql = "Select NextPage, PrevPage from tablename where projectname =
'"& pageName & "'

set rs= con.execute(sql)

If not rs.eof then
prevPage = rs.Fields("PrevPage")
nextPage = rs.Fields("NextPage")
end if
%>

your current page i.e. Page1.asp will contain 2 links going to previous page and going to the next page.

<a href = <%= prevPage%>>Previous</a>
<a href = <%= nextPage%>>Next</a>





Hi, Thanks for that good link, I will need that for something else later.
I am not sure what I need is called.

I have a dropdown list that the user can select from, up to 300 pages.
They are ordered alphabetically by name.
I was sort of thinking it would be good if each page, although dynamically produced from
the database, had a next link, that could then be used by the visitor to
go through all the records next, next, instead of having to go back to the dropdown.
The problem is I dont know how that link should be written so that it sends the visitor to the next.

The link I have is like this
Expand|Select|Wrap|Line Numbers
  1. <a href="page.asp?author=<%=rsCard("author")%>">link</a>
so I imagine the code would be saying that + 1 record

Thanks for any help.

Richard
Oct 31 '07 #4
fran7
229 100+
Thanks that look exactly what I need. I cannot get it working though, just this error

Expand|Select|Wrap|Line Numbers
  1. Microsoft VBScript runtime error '800a01a8' 
  2.  
  3. Object required: '' 
  4.  
  5. /artgallery3.asp, line 65
The line in question is this one
Expand|Select|Wrap|Line Numbers
  1. set rsCard= con.execute(sql)
I code as I have it now looks like this.

Expand|Select|Wrap|Line Numbers
  1. Dim sql
  2. Dim rsCard
  3. Dim con
  4. Dim pageName
  5. Dim prevPage
  6. Dim nextPage
  7.  
  8. pageName = "artgallery.asp?Author=Amira%20Murhej"
  9. set rsCard= con.execute(sql)
  10. sql = "Select NextPage, PrevPage From tblGreetingPostCards where projectname ='"& pageName & "'"
  11.  
  12.  
  13.  
  14. If not rsCard.eof then
  15. prevPage = rsCard.Fields("PrevPage") 
  16. nextPage = rsCard.Fields("NextPage")
  17. end if
Have I made an error here.
Thanks for your help
Richard
Oct 31 '07 #5
markrawlingson
346 Expert 100+
set rsCard= con.execute(sql)
sql = "Select NextPage, PrevPage From tblGreetingPostCards where projectname ='"& pageName & "'"
These two lines need to be reversed.

On line 1 of the quote above, you are telling your connection to the database to execute the statement held within the sql variable - but the sql variable is empty at this point - you set the value of the sql variable below it.

ASP reads from top to bottom, left to right, like you would read a book. Most programming languages do actually.

Also, the connection Execute() method does not need to be set into an object level variable. You just cnn.Execute(sql). The Execute() method is used normally to do insert or update statements, if you want to use a select statement and have it return records you'd be best to open a recordset instead

Replace the code above with this.

Expand|Select|Wrap|Line Numbers
  1. sql = "Select NextPage, PrevPage From tblGreetingPostCards where projectname ='"& pageName & "'"
  2. Set oRs = Server.CreateObject("ADODB.RecordSet")
  3. oRS.Open sql,cnn,3,3
  4.  
Sincerely,
Mark
Oct 31 '07 #6
fran7
229 100+
Thanks Mark. I do get this error though.


Expand|Select|Wrap|Line Numbers
  1. ADODB.Recordset error '800a0cb3' 
  2. Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype. 
  3.  
  4. /artgallery3.asp, line 264
If you have any ideas great. If not thanks for your time. Much appreciated.
Richard
Nov 1 '07 #7
markrawlingson
346 Expert 100+
I think you are probably trying to perform some sort of paging process on your page as per the original post - you have to supply further information to the recordset if you are doing that (such as, the cursor type).

Show you're code and we'll have a look see but in the mean time you might want to try the following...

Expand|Select|Wrap|Line Numbers
  1. sql = "Select NextPage, PrevPage From tblGreetingPostCards where projectname ='"& pageName & "'"
  2. Set oRs = Server.CreateObject("ADODB.RecordSet")
  3. oRs.CursorType = 2
  4. oRS.Open sql,cnn,3,3
  5.  
Sincerely,
Mark
Nov 1 '07 #8
fran7
229 100+
Dear Mark, Well thanks. I tried the other but I got

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/artgallery3.asp, line 227


You are brave to look at this code, thats all there is at the top of the page.

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <!--#Include File="art/dbconnect.asp"-->
  3. <%
  4.  
  5. Dim oRs, conn, connect, strSQL
  6.  
  7. set conn=server.CreateObject ("adodb.connection")
  8. connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/fpdb/greetingcardpro.mdb") & ";Persist Security Info=False"
  9. conn.Open connect
  10.  
  11.  
  12.  
  13. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  14. '   Product:  Greeting Card Pro Version 2.1
  15. '   Author:   AdComplete.com, LLC
  16. '   Date: January 21, 2002                
  17. '   (c) Copyright 2000-2002 by AdComplete.com, LLC.  All rights reserved.
  18. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  19.  
  20. lngCategoryID=CLng(Request("CategoryID"))
  21. If lngCategoryID <> "" And lngCategoryID <> 0 Then
  22.  
  23.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  24.     connPostCardSoft.Open PostCardSoftConnectString
  25.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  26.     rsCard.CursorLocation = 3
  27.     SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,keywords,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CategoryID=" & Clng(lngCategoryID) & " Order By Rnd([PostCardID])"
  28.     rsCard.Open SQLQuery, connPostCardSoft
  29.        rsCard.PageSize = 600
  30.        intPageCount = rsCard.PageCount
  31.  
  32.        If rsCard.EOF=True Then
  33.         Response.Write "<p>No cards found in database for this category."
  34.         Response.End
  35.     End If
  36. End If
  37.  
  38. description=Request("CardDescription")
  39. If description <> "" Then
  40.  
  41.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  42.     connPostCardSoft.Open PostCardSoftConnectString
  43.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  44.     rsCard.CursorLocation = 3
  45.     SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,keywords,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CardDescription='" & description & "' Order By Rnd([PostCardID])"
  46.     rsCard.Open SQLQuery, connPostCardSoft
  47.        rsCard.PageSize = 600
  48.        intPageCount = rsCard.PageCount
  49.  
  50.     If rsCard.EOF=True Then
  51.         Response.Write "<p>No cards found in database for this category."
  52.         Response.End
  53.     End If
  54. End If
  55.  
  56.  
  57.  
  58.  
  59.  
  60. description=Request("Author")
  61. If description <> "" Then
  62.  
  63.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  64.     connPostCardSoft.Open PostCardSoftConnectString
  65.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  66.     rsCard.CursorLocation = 3
  67.     SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author,keywords,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where Author='" & description & "' Order By Rnd([PostCardID])"
  68.     rsCard.Open SQLQuery, connPostCardSoft
  69.        rsCard.PageSize = 600
  70.        intPageCount = rsCard.PageCount
  71.  
  72.     If rsCard.EOF=True Then
  73.         Response.Write "<p>No cards found in database for this category."
  74.         Response.End
  75.     End If
  76. End If
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. 'search feature
  85. If Request("SearchWord") <> "" Then
  86.     strWd=Replace(Request("SearchWord"),"'","''")
  87.     strSQL="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author, "
  88.     strSQL=strSQL & " ThumbnailURL,AdvancedCard,ThumbnailHTML From tblGreetingPostCards Where Keywords Like '%" & strWD & "%' OR "
  89.     strSQL=strSQL & " DefaultHeadline Like '%" & strWD & "%' OR "
  90.     strSQL=strSQL & " CardDescription Like '%" & strWD & "%' OR "
  91.     strSQL=strSQL & " Author Like '%" & strWD & "%' OR "
  92.     strSQL=strSQL & " DefaultMessage Like '%" & strWD & "%' "
  93.  
  94.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  95.     connPostCardSoft.Open PostCardSoftConnectString
  96.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  97.     rsCard.CursorLocation = 3
  98.     rsCard.Open strSQL, connPostCardSoft
  99.        rsCard.PageSize = 600
  100.        intPageCount = rsCard.PageCount
  101. End If
  102.  
  103. strAddition="bgcolor=" & Chr(34) & Application("gcp_SearchPageBackgroundColor") & Chr(34)
  104. strCategoryBarFontColor=Application("gcp_SearchPageFontBarColor")
  105. strCategoryBarColor=Application("gcp_SearchPageBarColor")
  106.  
  107. 'Retrieve Category Name
  108. If lngCategoryID <> "" and lngCategoryID <> 0 Then
  109.     Set rsCat=connPostCardSoft.Execute("Select * From tblGreetingCategories Where CategoryID=" & Clng(lngCategoryID))
  110.     strCat="" & rsCat("CategoryName")
  111.  
  112.     If rsCat("CategoryBackgroundImage")<> "" Then
  113.         strAddition="background=" & Chr(34) & rsCat("CategoryBackgroundImage") & Chr(34)
  114.     End If
  115.     If rsCat("CategoryBackgroundColor")<>"" Then
  116.         strAddition="bgcolor=" & Chr(34) & rsCat("CategoryBackgroundColor") & Chr(34)
  117.     End If
  118.     strCategoryBarFontColor=rsCat("CategoryBarFontColor")
  119.     strCategoryBarColor=rsCat("CategoryBarColor")
  120.     FontName=rsCat("FontName")
  121.     FontColor=rsCat("FontColor")
  122. Else
  123.     strCat="Search results for:" & strWD
  124.     FontName=Application("gcp_FontName")
  125.     FontColor=Application("gcp_FontColor")
  126. End If
  127.  
  128.  
  129.    Select Case Request("Action")
  130.            case "  <<  "
  131.                    intpage = 1
  132.            case "  <  "
  133.                    intpage = Request("intpage")-1
  134.                    if intpage < 1 then intpage = 1
  135.            case "  >  "
  136.                    intpage = Request("intpage")+1
  137.                    if intpage > intPageCount then intpage = IntPageCount
  138.            Case "  >>  "
  139.                    intpage = intPageCount
  140.            case else
  141.                    intpage = 1
  142.                    If Request.QueryString("intpage") <> "" Then
  143.                        intpage=Request.QueryString("intpage")
  144.                    End If
  145.    end select
  146.  
  147.  
  148.  
  149. %>
Thanks
Richard
Nov 1 '07 #9
markrawlingson
346 Expert 100+
Hi Richard,

I noticed you are not passing any ADO constants when you're opening your recordset. These are needed to tell the database what LockType to use, and what cursor type to use, amongst other things - but those are the only two that are required.

Expand|Select|Wrap|Line Numbers
  1. 'Create a recordset object
  2. Set oRs = Server.CreateObject("ADODB.RecordSet")
  3. 'Set a variable to send into the recordset to pull info from the db.
  4. sSQL = "some sql statement"
  5. 'Open the recordset, pass in the SQL statement to tell it what to retrieve, pass the connection object to tell it where to find our database, pass our ADO constants to tell the database which Cursor type and lock type to use
  6. oRs.Open sSQL,cnn, adOpenReadOnly, adLockOptimistic
  7.  
  8. 'This can also be achieved like so...
  9. oRs.Open sSQL,cnn,3,3
  10.  
  11. 'or...
  12. oRs.LockType = 3
  13. oRs.CursorType = 3
  14. oRs.Open sSQL,cnn
  15.  
  16. 'note that when using this method the locktype and cursor type must be passed before actually opening the recordset and passing your SQL query and connection string.
  17.  
The most straight forward way would be the second way mentioned above... oRs.Open sSQL,cnn,3,3 - but hardened developers usually refer to them by their ado constant names - such as adOpenReadOnly so that we can visually see what cursor type is being passed, rather than having to interpret what is being passed by "3,3".

Hope this helps.
Sincerely,
Mark
Nov 1 '07 #10
fran7
229 100+
Thanks Mark, I will have to spend some time going through what you have said.
Thanks for all the kind help
Richard
Nov 2 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Willoughby Bridge | last post by:
Hi - Having trouble getting a multipart series of forms to move to the next form. The problem line is: <form method="post" enctype="multipart/form-data" action="Data_Form1.php"> If the...
4
by: Mohammed Mazid | last post by:
Can anyone please help me on how to move to the next and previous question? Here is a snippet of my code: Private Sub cmdNext_Click() End Sub Private Sub cmdPrevious_Click() showrecord
1
by: cwessel | last post by:
I have growers with multiple orchards and blocks in my database. When a query is created, the grower name is repeated for each orchard under that grower. When I create a form, I have the...
3
by: Rich | last post by:
Hello, If my datagrid is based on a dataTable (t1) and the currency manager is also bound to t1 and I do a find on a key dim dRow As DataRow, t1 As DataTable .... dRow = t1.Rows.find(somekey)...
1
by: Lars Netzel | last post by:
Hi If I'm in the last cell (on a row) of a datagrid, how do I, on TAB or something, move to the First Cell of the next row? regards /Lars
0
by: Byomokesh | last post by:
Hi, I have problem facing in Linking Tags. Linking are 3 types. <!-- Just remark Id --> :( 1. Pref02fn1 <!-- This footnote text move to paragraph in place of link tags. --> 2....
2
TMS
by: TMS | last post by:
Schools over!!! Now its time to play. I would like to learn how to make objects move from one location to the next on a canvas widget. For example: from Tkinter import * class square:...
0
by: Tetravaal | last post by:
I normally don't ask for help on forums, especially when I know that I am WAY out my league but if your feeling kind, feel free to contribute! I need to compare two cells (D2 and D3) and if they...
3
by: jaeden99 | last post by:
I was wandering if nyone has a script to move files older than x days old? i've seen several to delete, but I don't want to delete. I would like to create a backup of the files first verify with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.