473,626 Members | 3,353 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

paging error handling

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("C urrentPage"))
if currentPage = "" then currentPage = 1 end if
set conn = server.CreateOb ject("ADODB.Con nection")
conn.connection string = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source="
& Server.MapPath( "/db/upload/stellad.mdb") & ";"
conn.open
set rs = server.CreateOb ject("ADODB.Rec ordset")
rs.CursorType = 3
rs.PageSize = 1
rs.Open "SELECT Username, Password FROM Account",conn
rs.AbsolutePage = cInt(currentPag e)
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><f ont 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(currentPag e) > 1 Then %>
<A HREF="paging.as p?currentPage=< %=currentPage-1%>">Prior</A>
<% End If %>

<% If CInt(currentPag e) < CInt(rs.PageCou nt) Then %>
<A HREF="paging.as p?currentPage=< %=currentPage+1 %>">Next</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.

Jun 25 '06 #1
1 1405
> on error resume next
Dim conn, rs
Dim currentPage, rowCount, i
currentPage = Trim(Request("C urrentPage"))
if currentPage = "" then currentPage = 1 end if
set conn = server.CreateOb ject("ADODB.Con nection")
conn.connection string = "Provider=Micro soft.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
Jun 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2243
by: enak | last post by:
I can not get my datagrid to page. I have a datagrid that I can sort 2 of the columns. This works great. I added paging and when I display the dg it shows 5 pages. (I am showing page numbers at the bottom of the dg.) When I click on the pages nothing happens until I get to the last page. Then and only then is the last page displayed. If I go back through the pages the second to last page displayes the first page again.
3
1627
by: Jeremy Ames | last post by:
Is there a way to setup paging with a data reader? For instance, I only want 10 records at a time, and I can move through the next ten when I need them. From the members that I saw listed in the MSDN library, it does not appear that there is. Can someone please help? Also, is there a way to find out the number of results that a stored procedure returns?
1
1407
by: Danny Ni | last post by:
Hi, We use ASP.Net datagrid paging a lot and we have been experiencing "Index out of bound" error messages when we click on rows of datagrid on differnet pages every now and then. The problems do not apear to be consistent, they could happen anywhere, anytime. We only use datagrid's default paging ability. That is, set AllowPaging property to true and write a handler for PageIndexChanged. Somebody told me this is datagrid's...
2
6446
by: farhad13841384 | last post by:
Hi , I Hope You fine. I have some problem with this code for paging in asp.net this bottom code work correctly without any error but when I try to place separate code in .VB file then error is begin and occured .I want to separate this code and compiling .vb code using VBC.exe later .(bin/paging.dll) when do it like me so you retrive only < Previous Page Next Page > in your web browser and you don't retrive list Of data in your web browser....
3
2185
by: Marc Grutte | last post by:
Hi I am trying to bind a custom datasource to a gridview whilst paging is enabled. What is missing in this code to make the paging + binding work? thanks M <%@ Page Language="VB" %>
2
5507
by: wallconor | last post by:
Hi, I am having a problem using Dreamweaver CS3 standard recordset paging behavior. It doesn’t seem to work when I pass parameter values from a FORM on my search page, to the recordset on my results page. - Recordset Paging works if no parameters are used in the recordset sql code (ie. simple sql code): SELECT * FROM db_name WHERE (db_field1 LIKE ‘%text1%’ OR db_field2 LIKE ‘%text2%’)
1
1818
by: Matt Winward | last post by:
Hi all. I've got a little problem with my gridview paging and I'm not sure how to resolve it. Basically, I'm handling all aspx requests with my own httphandler. This does a url rewrite, so the url you see is not the page that is actually returned. To add to the complexity, I have a module which does a similar url rewrite at a higher level.
6
2141
by: cmrchs | last post by:
Hello, I have set the Allowpaging property to true in a standard DataGrid- control (System.Web.UI.WebControls). when run in the browser i get the first records in the first page, there are 5 pagesi n total, but when I click on the next page number, I always get the records of the first page ? how come?
1
1768
by: chris3vic | last post by:
I have a dynamically created datagrid, populated from a dataset that is filled by a sql string triggered by a command button. The application itself allows a user to input a selection of criteria and hit search, the results ome back in the grid. Due to the probably amount of records that will be returd, I decided to allow paging to make the data more visually appealing. So far, so good. Everything is running smoothly until.. you try to selct...
0
8265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7193
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2625
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.