PDA

View Full Version : where the error in the code


bmwmpower
03-30-2003, 08:58 AM
i need help where the error code

<html>
<head>
<title>Recordset Paging</title>
</head>
<body>

<%
Dim sql
Dim RECORDSPERPAGE
RECORDSPERPAGE = 10

Set DbConn = Server.CreateObject("ADODB.Connection")
dbDir = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("SEARCH.MDB") & ";"
DbConn.open dbDir

sql = "SELECT * FROM report"

Set rs = Server.CreateObject("ADODB.RECORDSET")
rs.CursorLocation = adUseCLient
rs.Open sql, DBConn, adOpenStatic, adLockReadOnly, adCmdText

call PagingMain()
%>

<table width="100%" border="0">
<tr>
<td width="50%" align="left">Page <%=intPagenum%> of <%=rs.PageCount%></td>
<td width="50%" align="right"><%=rs.RecordCount%> members.</td>
</tr>
</table>
<%
rs.AbsolutePage = intPageNum
For intCount = 1 To rs.PageSize
%>
<form action="Yourpagename.asp" method="post" name="log">
<table border="0" cellpadding="3" cellspacing="3" align="center">
<tr bgcolor="#0080C0">
<th><font color="white" face="Verdana, Arial" size=2>UserName:</font></th>
<th><font color="white" face="Verdana, Arial" size=2>Node/Cluster</font></th>
<th><font color="white" face="Verdana, Arial" size=2>Time(PST):</font></th>
<th><font color="white" face="Verdana, Arial" size=2>Date:</font></th>
<th><font color="white" face="Verdana, Arial" size=2>Delete:</font></th>
</tr>
<%
user = rs("Name")
id = rs("Id")
t = rs("Timeadded")
d = rs("Dateadded")
node = rs("Node_cluster")
%>
<tr bgcolor="#DADADA">
<td><font face="Verdana, Arial" size=2 color="#000080"><div align="center"><%=user%></div></font></td>
<td><font face="Verdana, Arial" size=2 color="#000080"><div align="center"><%=node%></div></font></td>
<td><font face="Verdana, Arial" size=2 color="#000080"><div align="center"><%=t%></div></font></td>
<td><font face="Verdana, Arial" size=2 color="#000080"><div align="center"><%=d%></div></font></td>
<td><div align="center">
<input type="checkbox" name="DeleteLog" value="<%=id%>"></div></td>
</tr>
<%
rs.MoveNext
If rs.EOF Then Exit For
Next
%>
<tr>
<td colspan="3">&nbsp;</td>
<td colspan="2" align="right" bgcolor="#0080C0">
<input name="allbox" type="checkbox" value="Check All" onClick="CheckAll();">
&nbsp;&nbsp;<font color=white face=verdana size=2><b>select all</b></font></td>

</tr>
<tr>
<td colspan="5"><center><input type="submit" name="Delete" value="Delete Selected"></center></td>
</tr>
</table>
</form>
<br>
<center><%call DisplayNavigation()%></center>

<!--#include file="paging.inc"-->

<%
rs.Close
DbConn.Close
Set rs = Nothing
Set DbConn = Nothing
%>

Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/Yourpagename.asp, line 19

Bullschmidt
03-30-2003, 07:12 PM
If report is indeed the name of the table, then perhaps try something more like this:

sql = "SELECT * FROM [report]"

raf
03-31-2003, 06:02 AM
It would really surprise me if that was the problem.

The error points to this line

rs.CursorLocation = adUseCLient

if i counted it right. What is that line for?
Did you try printing the value from that line? to print it, insert this code wright after it

response.write rs.CursorLocation
response.end

pankaj
03-31-2003, 06:31 AM
rs.Open sql, DBConn, adOpenStatic, adLockReadOnly, adCmdText

I think the p[roblem is in this statement. I dont know the details but try "adOpenStatic, adLockReadOnly " changing this combination

bmwmpower
04-05-2003, 12:01 PM
ok can u help me to know how i can display only 10 Record and in my database i have 1000 Record so i want display only in page 10 Record

raf
04-05-2003, 12:20 PM
Run a search for recordset paging. It's been handeled here several times here and every external searchengine will turn up dozens of tutorials on the subject.

"In stead of giving someone a fish, teach him how to fish";)

My opinion; stay away from it (unless you think a client will run throug 100 pages to find his record