Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > paging error handling

Reply
Thread Tools

paging error handling

 
 
solomon_13000
Guest
Posts: n/a
 
      06-25-2006
I inserted an error handling code for the code bellow. What happen is
the page is taking a long time to load. Upon loading it takes me to
"page not found" of microsoft internet explorer. How do I solve the
problem?


<html>
<head>
<title></title>
</head>
<body>
<%
on error resume next
Dim conn, rs
Dim currentPage, rowCount, i
currentPage = Trim(Request("CurrentPage"))
if currentPage = "" then currentPage = 1 end if
set conn = server.CreateObject("ADODB.Connection")
conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
& Server.MapPath("/db/upload/stellad.mdb") & ";"
conn.open
set rs = server.CreateObject("ADODB.Recordset")
rs.CursorType = 3
rs.PageSize = 1
rs.Open "SELECT Username, Password FROM Account",conn
rs.AbsolutePage = cInt(currentPage)
rowCount = 0

while not rs.EOF and rowCount < rs.PageSize
response.write rs("Username") & "<BR>"
rowCount = rowCount + 1
rs.movenext
wend

If err <> 0 then
Response.Write "<center><font class='error'>" & Err.number & ":" &
Err.Description & "</font></center><br>"
conn.Close
Set conn = nothing
On Error Goto 0
Response.End
End If
conn.close
set conn = nothing
%>

<% If CInt(currentPage) > 1 Then %>
<A HREF="paging.asp?currentPage=<%=currentPage-1%>">Prior</A>
<% End If %>

<% If CInt(currentPage) < CInt(rs.PageCount) Then %>
<A HREF="paging.asp?currentPage=<%=currentPage+1%>">N ext</A>
<% End If %>

</body>
</html>


It works, however if I change the database name

valid db name: stelladb.mdb to an invalid db name: stellad.mdb

It cant handle the error. The page takes time to load, and the result
is "page not found" of microsoft internet explorer.

 
Reply With Quote
 
 
 
 
Aaron Bertrand [SQL Server MVP]
Guest
Posts: n/a
 
      06-25-2006
> on error resume next
> Dim conn, rs
> Dim currentPage, rowCount, i
> currentPage = Trim(Request("CurrentPage"))
> if currentPage = "" then currentPage = 1 end if
> set conn = server.CreateObject("ADODB.Connection")
> conn.connectionstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
> & Server.MapPath("/db/upload/stellad.mdb") & ";"
> conn.open


If you're trying to trap errors in connecting to the database, then put some
error handling right here! Waiting until AFTER trying to execute 40
statements, all of which depend on the success of this one, is not going to
get you too far.

A


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
python list handling and Lisp list handling Mark Tarver Python 22 04-26-2009 09:36 PM
Combining numeric mode paging and nextPreview paging in datagrid Red ASP .Net 1 03-12-2005 11:41 PM
datagrid paging - customising paging style wh1974 ASP .Net 0 01-12-2005 03:48 PM
DataSet paging vs Datareader paging =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 1 10-08-2004 02:13 PM
Paging Dr. Who, Paging Dr. Who... Father_Sicko@TheOrphanage.com Computer Security 1 07-02-2004 08:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57