Hi, Anyone know the simplest solution to add a next record link.
I have this -
<a href="page.asp?author=<%=rsCard("author")%>">link</a>
-
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
10 2685
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 -
<a href="page.asp?author=<%=rsCard("author")%>">link</a>
-
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
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 - <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
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 - <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
Thanks that look exactly what I need. I cannot get it working though, just this error - Microsoft VBScript runtime error '800a01a8'
-
-
Object required: ''
-
-
/artgallery3.asp, line 65
The line in question is this one - set rsCard= con.execute(sql)
I code as I have it now looks like this. - Dim sql
-
Dim rsCard
-
Dim con
-
Dim pageName
-
Dim prevPage
-
Dim nextPage
-
-
pageName = "artgallery.asp?Author=Amira%20Murhej"
-
set rsCard= con.execute(sql)
-
sql = "Select NextPage, PrevPage From tblGreetingPostCards where projectname ='"& pageName & "'"
-
-
-
-
If not rsCard.eof then
-
prevPage = rsCard.Fields("PrevPage")
-
nextPage = rsCard.Fields("NextPage")
-
end if
Have I made an error here.
Thanks for your help
Richard
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. -
sql = "Select NextPage, PrevPage From tblGreetingPostCards where projectname ='"& pageName & "'"
-
Set oRs = Server.CreateObject("ADODB.RecordSet")
-
oRS.Open sql,cnn,3,3
-
Sincerely,
Mark
Thanks Mark. I do get this error though. - ADODB.Recordset error '800a0cb3'
-
Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype.
-
-
/artgallery3.asp, line 264
If you have any ideas great. If not thanks for your time. Much appreciated.
Richard
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... -
sql = "Select NextPage, PrevPage From tblGreetingPostCards where projectname ='"& pageName & "'"
-
Set oRs = Server.CreateObject("ADODB.RecordSet")
-
oRs.CursorType = 2
-
oRS.Open sql,cnn,3,3
-
Sincerely,
Mark
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. -
<%@ Language=VBScript %>
-
<!--#Include File="art/dbconnect.asp"-->
-
<%
-
-
Dim oRs, conn, connect, strSQL
-
-
set conn=server.CreateObject ("adodb.connection")
-
connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/fpdb/greetingcardpro.mdb") & ";Persist Security Info=False"
-
conn.Open connect
-
-
-
-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
' Product: Greeting Card Pro Version 2.1
-
' Author: AdComplete.com, LLC
-
' Date: January 21, 2002
-
' (c) Copyright 2000-2002 by AdComplete.com, LLC. All rights reserved.
-
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
-
-
lngCategoryID=CLng(Request("CategoryID"))
-
If lngCategoryID <> "" And lngCategoryID <> 0 Then
-
-
Set connPostCardSoft=Server.CreateObject("ADODB.Connection")
-
connPostCardSoft.Open PostCardSoftConnectString
-
Set rsCard=Server.CreateObject("ADODB.Recordset")
-
rsCard.CursorLocation = 3
-
SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,keywords,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CategoryID=" & Clng(lngCategoryID) & " Order By Rnd([PostCardID])"
-
rsCard.Open SQLQuery, connPostCardSoft
-
rsCard.PageSize = 600
-
intPageCount = rsCard.PageCount
-
-
If rsCard.EOF=True Then
-
Response.Write "<p>No cards found in database for this category."
-
Response.End
-
End If
-
End If
-
-
description=Request("CardDescription")
-
If description <> "" Then
-
-
Set connPostCardSoft=Server.CreateObject("ADODB.Connection")
-
connPostCardSoft.Open PostCardSoftConnectString
-
Set rsCard=Server.CreateObject("ADODB.Recordset")
-
rsCard.CursorLocation = 3
-
SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,keywords,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CardDescription='" & description & "' Order By Rnd([PostCardID])"
-
rsCard.Open SQLQuery, connPostCardSoft
-
rsCard.PageSize = 600
-
intPageCount = rsCard.PageCount
-
-
If rsCard.EOF=True Then
-
Response.Write "<p>No cards found in database for this category."
-
Response.End
-
End If
-
End If
-
-
-
-
-
-
description=Request("Author")
-
If description <> "" Then
-
-
Set connPostCardSoft=Server.CreateObject("ADODB.Connection")
-
connPostCardSoft.Open PostCardSoftConnectString
-
Set rsCard=Server.CreateObject("ADODB.Recordset")
-
rsCard.CursorLocation = 3
-
SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author,keywords,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where Author='" & description & "' Order By Rnd([PostCardID])"
-
rsCard.Open SQLQuery, connPostCardSoft
-
rsCard.PageSize = 600
-
intPageCount = rsCard.PageCount
-
-
If rsCard.EOF=True Then
-
Response.Write "<p>No cards found in database for this category."
-
Response.End
-
End If
-
End If
-
-
-
-
-
-
-
-
'search feature
-
If Request("SearchWord") <> "" Then
-
strWd=Replace(Request("SearchWord"),"'","''")
-
strSQL="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author, "
-
strSQL=strSQL & " ThumbnailURL,AdvancedCard,ThumbnailHTML From tblGreetingPostCards Where Keywords Like '%" & strWD & "%' OR "
-
strSQL=strSQL & " DefaultHeadline Like '%" & strWD & "%' OR "
-
strSQL=strSQL & " CardDescription Like '%" & strWD & "%' OR "
-
strSQL=strSQL & " Author Like '%" & strWD & "%' OR "
-
strSQL=strSQL & " DefaultMessage Like '%" & strWD & "%' "
-
-
Set connPostCardSoft=Server.CreateObject("ADODB.Connection")
-
connPostCardSoft.Open PostCardSoftConnectString
-
Set rsCard=Server.CreateObject("ADODB.Recordset")
-
rsCard.CursorLocation = 3
-
rsCard.Open strSQL, connPostCardSoft
-
rsCard.PageSize = 600
-
intPageCount = rsCard.PageCount
-
End If
-
-
strAddition="bgcolor=" & Chr(34) & Application("gcp_SearchPageBackgroundColor") & Chr(34)
-
strCategoryBarFontColor=Application("gcp_SearchPageFontBarColor")
-
strCategoryBarColor=Application("gcp_SearchPageBarColor")
-
-
'Retrieve Category Name
-
If lngCategoryID <> "" and lngCategoryID <> 0 Then
-
Set rsCat=connPostCardSoft.Execute("Select * From tblGreetingCategories Where CategoryID=" & Clng(lngCategoryID))
-
strCat="" & rsCat("CategoryName")
-
-
If rsCat("CategoryBackgroundImage")<> "" Then
-
strAddition="background=" & Chr(34) & rsCat("CategoryBackgroundImage") & Chr(34)
-
End If
-
If rsCat("CategoryBackgroundColor")<>"" Then
-
strAddition="bgcolor=" & Chr(34) & rsCat("CategoryBackgroundColor") & Chr(34)
-
End If
-
strCategoryBarFontColor=rsCat("CategoryBarFontColor")
-
strCategoryBarColor=rsCat("CategoryBarColor")
-
FontName=rsCat("FontName")
-
FontColor=rsCat("FontColor")
-
Else
-
strCat="Search results for:" & strWD
-
FontName=Application("gcp_FontName")
-
FontColor=Application("gcp_FontColor")
-
End If
-
-
-
Select Case Request("Action")
-
case " << "
-
intpage = 1
-
case " < "
-
intpage = Request("intpage")-1
-
if intpage < 1 then intpage = 1
-
case " > "
-
intpage = Request("intpage")+1
-
if intpage > intPageCount then intpage = IntPageCount
-
Case " >> "
-
intpage = intPageCount
-
case else
-
intpage = 1
-
If Request.QueryString("intpage") <> "" Then
-
intpage=Request.QueryString("intpage")
-
End If
-
end select
-
-
-
-
%>
Thanks
Richard
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. -
'Create a recordset object
-
Set oRs = Server.CreateObject("ADODB.RecordSet")
-
'Set a variable to send into the recordset to pull info from the db.
-
sSQL = "some sql statement"
-
'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
-
oRs.Open sSQL,cnn, adOpenReadOnly, adLockOptimistic
-
-
'This can also be achieved like so...
-
oRs.Open sSQL,cnn,3,3
-
-
'or...
-
oRs.LockType = 3
-
oRs.CursorType = 3
-
oRs.Open sSQL,cnn
-
-
'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.
-
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
Thanks Mark, I will have to spend some time going through what you have said.
Thanks for all the kind help
Richard
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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
|
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...
|
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)...
|
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
|
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....
|
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:...
|
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...
|
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...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
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...
|
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)...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
|
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...
| |