Link to home
Create AccountLog in
Web Development

Web Development

--

Questions

--

Followers

Top Experts

Avatar of eez81
eez81

Current Recordset does not support bookmarks
I want to display a record like 5 record perpage...from mdb file.when i run the code,i got an error below....what is it mean?????

****************************
Error Type:
ADODB.Recordset (0x800A0CB3)
Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype.
/spick/pages.asp, line 48
****************************

line 48:
rs.AbsolutePage = PageIndex 'Define what page number on which the current record resides.


Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of CaptainRantflapsCaptainRantflaps

This could be caused by the cursor type being used when opening the recordset. can you show us more code?

Avatar of eez81eez81

ASKER

here are the code:-

******************
file:pages.asp
*******************

<%option explicit%>
<!-- #include file="pages_support.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><style type="text/css">
td{
font-family: verdana;
font-style: normal;
font-weight: bold;
font-size: .6em;
}
</style></head><body>

<%
'########## DSN-less connections ############################################################################################
Dim DBName, objConn, rs, strSQL      '//Variables we need
DBName = server.mappath("spick98.mdb")'//Database file !CHANGE IF NEEDED!

'//Create ADO connection
Set objConn = Server.CreateObject("ADODB.Connection")

'//Open our student database with this string
objConn.ConnectionString = "DBQ=" & DBName & ";Driver={Microsoft Access Driver (*.mdb)};"

'//Access our database
objConn.Open

'//Create a recordset
Set rs = Server.CreateObject("ADODB.Recordset")

'######################################################################################################
      
      strSQL = "SELECT * FROM DAFTARHARTASH01 ORDER BY id_no"
      set rs = objConn.Execute(strSQL)


Dim IntPageSize, PageIndex, TotalPages, TotalRecords
Dim RecordCount, RecordNumber

IntPageSize = 5
PageIndex = Request("PageIndex")
'If pageIndex is empty, set it to one.
if PageIndex = "" then PageIndex = 1      

RecordCount = rs.RecordCount
RecordNumber = (PageIndex * IntPageSize) - (IntPageSize)

rs.PageSize = intPageSize ' Set the number of records per page
rs.AbsolutePage = PageIndex 'Define what page number on which the current record resides.

TotalPages = rs.PageCount

dim intPrev, intNext
intPrev = PageIndex - 1
intNext = PageIndex + 1 'same as rs.AbsolutePage

'Build table header
With Response
      .write "<table border=1 cellpadding=5 cellspacing=0>"
      .write "<tr bgcolor=goldenrod>"
      .write "<td>###</td>"
      .write "<td>ID</td>"
      .write "<td>Jenama</td>"
      .write "<td>No Harta</td>"
      .write "<td>KOd Kumpulan</td>"
      .write "<td>No Siri</td>"
      .write "<td>Lokasi</td>"
      .write "</tr>"
end with

Dim Count 'We'll use this to limit the number of records displayed on a page
Count = 1
do while NOT rs.EOF AND Count <= IntPageSize
      With Response
            .Write"<tr>"
            .Write "<td>" & RecordNumber + Count & "</td>"
            .Write "<td>" & rs("id_no") & "</td>"
            .Write "<td>" & rs("jenama") & "</td>"
            .Write "<td>" & rs("no_harta1") & "</td>"
            .Write "<td>" & rs("kod_kumpulan") & "</td>"
            .Write "<td>" & rs("no_siri") & "</td>"
            .Write "<td>" & rs("lokasi") & "</td>"
            .write "</tr>"
      End with
      count = count + 1
      rs.MoveNext
loop
Response.Write "<tr><td align=center colspan=9 bgcolor=gainsboro>"
call BuildNav2 (intPrev,IntNext,TotalPages)
response.write "</td></tr></table>"
rs.close
%>
</body></html>


***********************************
file:pages_support.asp
***********************************

<%
Sub BuildNav2 (intPrev,IntNext,TotalPages)
      Dim counter
      Response.Write "<font face=verdana size=1><b>"
      
      ' If the previous page id is not 0, then let's add the 'prev' link.
      if intPrev <> 0 then
            With Response
                  .Write "<a href=pages.asp?PageIndex="
                  .Write intPrev & "><< previous</a>"
                  .Write  NBSP(5)
            End With
      end if

      'This section displays the list of page numbers as links, separated with the pipe ( | )
      counter = 1
      Response.Write  "jump to page: "
      do while counter <= TotalPages
            ' If the current page is the same as the counter, then write the page number with no hyperlink
            if cint(counter) = cint(PageIndex) then
                  Response.Write  counter
            Else
                  ' Else, let's write the page number as a hyperlink to that page
                  Response.Write  "<a href=pages.asp?PageIndex="
                  Response.Write  counter & ">" & Counter & "</a>"
            End if
            
            ' As long as we're not at the last page number in this loop, let's add a pipe to the string.
            if cInt(counter) <> TotalPages then
                  Response.Write  " | "
            end if
            counter = counter + 1
      Loop

      if (rs.AbsolutePage <> -3) then
            With Response
                  .Write  NBSP(5)
                  .Write "<a href=pages.asp?PageIndex="
                  .Write intNext & ">next >></a>"
            End With
      end if
      Response.Write "<br />" & rs.recordcount & " records found"
      Response.Write "</b></font>"
end Sub
%>

<%
function Connect()
      '########## DSN-less connections ############################################################################################
Dim DBName, objConn, rs, strSQL      '//Variables we need
DBName = server.mappath("spick98.mdb")'//Database file !CHANGE IF NEEDED!

'//Create ADO connection
Set objConn = Server.CreateObject("ADODB.Connection")

'//Open our student database with this string
objConn.ConnectionString = "DBQ=" & DBName & ";Driver={Microsoft Access Driver (*.mdb)};"

'//Access our database
objConn.Open

'//Create a recordset
Set rs = Server.CreateObject("ADODB.Recordset")
'######################################################################################################
      
end function
%>

<%
function NBSP(count)
      dim i
      for i = 1 to count
            NBSP = NBSP + "&nbsp;"
      next
end function
%>

Try setting the cursor type to Dynamic

ie

objConn.CursorType = adOpenDynamic (you might have to use the number value if you are using asp rather than .net).

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


adOpenDynamic = 2

Avatar of eez81eez81

ASKER

where to put this code....plz tell me ....i don't have an idea....

Change this;

   '//Open our student database with this string
   objConn.ConnectionString = "DBQ=" & DBName & ";Driver={Microsoft Access Driver (*.mdb)};"

   '//Access our database
   objConn.Open

To this;

   '//Open our student database with this string & CursorType = adOpenDynamic (2)
   objConn.ConnectionString = "DBQ=" & DBName & ";Driver={Microsoft Access Driver (*.mdb)};"
   objConn.CursorType = 2

   '//Access our database
   objConn.Open

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of eez81eez81

ASKER

then i got this error...

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch

Replace this;

   '//Create ADO connection
   Set objConn = Server.CreateObject("ADODB.Connection")

   '//Open our student database with this string
   objConn.ConnectionString = "DBQ=" & DBName & ";Driver={Microsoft Access Driver (*.mdb)};"

   '//Access our database
   objConn.Open

   '//Create a recordset
   Set rs = Server.CreateObject("ADODB.Recordset")

   '######################################################################################################

        strSQL = "SELECT * FROM DAFTARHARTASH01 ORDER BY id_no"
        set rs = objConn.Execute(strSQL)

ASKER CERTIFIED SOLUTION
Avatar of JagataJagata

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Here's the ADO API Reference as well (so you can read up on CursorType, CursorLocation, & LockType);
   http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdaobj01.asp

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of eez81eez81

ASKER

thanz Jagata..
peace...

No worries dude. Let me know if you have any questions about the replacement code.

Avatar of eez81eez81

ASKER

no..it work better..thanz 4 ur help...
may God bless u....

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.

Web Development

Web Development

--

Questions

--

Followers

Top Experts

Web development includes all aspects of presenting content on intranets and the Internet, including delivery development, protocols, languages and standards, server software, browser clients, databases and multimedia generation.