473,597 Members | 2,339 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP Error Handling

Dear all,

this error handling has been a pain since so manya days

using ASP 3.0 with IIS 5.0 on W2K server Created a custom error page
using the Server.GetLastE rror() and works fine in most of the cases.
Following are the issues :
1. Have a hughe file (5-6 mb approx) to upload, now if there are any
errors during upload i want to immediately throw an error and roll back
the transaction.
2. When the following error occurs, am not redirected to the custom
error page bu the same is displayed on the same page.
Error -
Microsoft OLE DB Provider for SQL Server error '80040e21'

Multiple-step OLE DB operation generated errors. Check each OLE DB
status value, if available. No work was done.

is there a way to trap the above error using the Server.GetLastE rror on
the custom error page

Pls help...

Thanks & Regards,
Niraj

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
8 3697
Dear Experts, pls help, i searched the whole of MSDN and all possilbe
sites , but can't get a silution to this.

Thanks & Regards,
Niraj

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #2
All MVPs, is there a solution to this... ?

Pls respond

Thanks & Regards,
Niraj

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
am following up desparetly cause this is a serious issue with ASP, is
there a way out .... ?

Thanks & Regards,
Niraj

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #4
"Niraj Khandwala" <kn****@vsnl.ne t> wrote in message
news:eo******** ******@TK2MSFTN GP11.phx.gbl...
All MVPs, is there a solution to this... ?

Pls respond

Thanks & Regards,
Niraj

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


I'm no MVP but to answer your question, yes there is a solution to this. Now
all that's missing is what THIS is.
Jul 19 '05 #5
hi, Chris, thanks for the response.

i have a hughe file to upload,,,,, now i write a loop and within the
loop the records get uploaded, is there a way to trap the error and
thorw it as soon as the error occurs.

currently am using the "on Error Resume Next" and then at the end of the
page "if err.Number .... blah blah..."

also this condition if Err.Number etc has limited properties, as in it
does not show the line number column number etc ... like the
Server.GetLastE rror object
Thanks & Regards,
Niraj

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #6
"Niraj Khandwala" <kn****@vsnl.ne t> wrote in message
news:ux******** ******@TK2MSFTN GP11.phx.gbl...
hi, Chris, thanks for the response.

i have a hughe file to upload,,,,, now i write a loop and within the
loop the records get uploaded, is there a way to trap the error and
thorw it as soon as the error occurs.

currently am using the "on Error Resume Next" and then at the end of the
page "if err.Number .... blah blah..."

also this condition if Err.Number etc has limited properties, as in it
does not show the line number column number etc ... like the
Server.GetLastE rror object


You could do it in JavaScript and use the try/catch construct. Or you can
put an error test immediately after each record upload in VBScript.
Something like

On Error Resume Next
'Do some stuff
'Start Loop
'Upload Record
If Err Then
'Do some error handling
End If
'End Loop

If you actually provide sample code, I could probably offer more than just
the "hand-waving" above. Also, could you specify database, version, DDL, and
sample data? Perhaps this could be done via a database utility like DTS for
SQL Server.
Jul 19 '05 #7
hey, Chris thanks,

here are the details
IIS5.0 , SQL Server 2000, No DLL used.

Sample code :
----------------------------------------
set oTs = oFs.OpenTextFil e(strFileName)
con.BeginTrans
On Error resume next
do while oTs.AtEndOfStre am = False
strLine = oTs.ReadLine
strArray = split(strLine," |")
if ubound(strArray ) > 0 then

rst("txt_idcode ") = ltrim(strArray( 0))
rst("nbr_micr") = strarray(1)
rst("amt_chkamt ") = cdbl(strarray(2 ))
rst("cod_state" ) = ltrim(strarray( 3))
blah blah ...
Loop

if Err.number <> 0
do error handling and roll back. but this does not show proper errors /
line number / column number and ADODB errors do not even redirect to my
custom error page :(
end if

_______________ ___
Thanks & Regards,
Niraj

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #8
"Niraj Khandwala" <kn****@vsnl.ne t> wrote in message
news:uu******** ******@TK2MSFTN GP12.phx.gbl...
hey, Chris thanks,

here are the details
IIS5.0 , SQL Server 2000, No DLL used.

Sample code :
----------------------------------------
set oTs = oFs.OpenTextFil e(strFileName)
con.BeginTrans
On Error resume next
do while oTs.AtEndOfStre am = False
strLine = oTs.ReadLine
strArray = split(strLine," |")
if ubound(strArray ) > 0 then

rst("txt_idcode ") = ltrim(strArray( 0))
rst("nbr_micr") = strarray(1)
rst("amt_chkamt ") = cdbl(strarray(2 ))
rst("cod_state" ) = ltrim(strarray( 3))
blah blah ...
Loop

if Err.number <> 0
do error handling and roll back. but this does not show proper errors /
line number / column number and ADODB errors do not even redirect to my
custom error page :(
end if


1. DLL stands for Data Definition Language or Data Declaration Language
depending on who you talk to. Regardless, it boils down to providing the
CREATE TABLE, CREATE INDEX, etc.. statements necessary to reproduce your
environment. That coupled with some sample data allows us to provide a
concrete solution instead of having to guess at what "blah blah..." means.
Here's an article:

http://aspfaq.com/etiquette.asp?id=5006
2. I'm assuming the rst is a ADODB.Recordset object. If so, you shouldn't be
using a recordset to perform DML (Data Manipulation Language such as INSERT,
UPDATE and DELETE). Use the Execute method of the connection object or the
"procedure-as-method" option. Here's another article:

http://aspfaq.com/show.asp?id=2191
3. This is almost certainly something that should be done with DTS (Data
Transformation Services) or BCP (Bulk Copy) is SQL Server. Please read the
related sections in BOL (Books Online).
4. If after all this you are still hell-bent on using this approach you will
need to inspect the ADODB.Connectio n.Errors collection instead of the Err
object. You will also need to define variables for current row and column as
you iterate through the source data. After each line that could possibly
generate an error, you will need to check the ADODB>Connectio n.Errors
collection and branch accordingly. As for transactions, I'm not sure DML via
a ADODB.Recordset object can participate in one. Another reason to rethink
the insert-via-recordset approach.

Sorry I couldn't be more help.
Jul 19 '05 #9

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

Similar topics

2
3262
by: WSeeger | last post by:
When creating a new class, is it encouraged to always include error handling routines within your LET and GET procedures? It's seems that most text books never seem to include much about error handling within classes. Just hoping to hear some programmer's thoughts on error handling.
12
6663
by: Christian Christmann | last post by:
Hi, assert and error handling can be used for similar purposes. When should one use assert instead of try/catch and in which cases the error handling is preferable? I've read somewhere that assert could be used to start an interactive debugger automatically. How do I realize that on a Linux machine using gcc?
6
8445
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order by VisitDt" I'm getting this error message: Errno is 2465. Err.description is "Can't find field '|' referred to in your expression"
13
4461
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently runs into problems on the system where it will actually be used, and since I used so little error-trapping it dies very ungracefully. I will of course try to fix whatever is causing the error and add error-trapping to the functions where the...
21
4393
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So if "global variables get re-set" doesn't tell the whole story, then what does? ***please note*** I'm not looking for a solution - I'm looking for a more detailed description of what happens when an un-handled error occurs - possibly with help file...
3
2844
by: Stefan Johansson | last post by:
Hi all I'am moving from Visual Foxpro and have a question regarding "best practice" error handling in vb .net. In VFP I have always used a "central" error handling object in order to have a easy and reusable way of handling all errors in a program. The VB 6 coding examples I have seen there has always been error handling code in each program module.
4
1924
by: Al Williams | last post by:
Hi, I have error handling in place throughout my application. I also start the application wrapped in error handling code to catch any unexpected exceptions (i.e. exceptions that occur where I haven't placed error handling code). When I run my app from the IDE, the unhandled errors are caught by the error handling code in my Sub Main routine and the error details are logged to a text file and optionally e-mailed to me for follow-up.
10
2277
by: Anthony England | last post by:
(sorry for the likely repost, but it is still not showing on my news server and after that much typing, I don't want to lose it) I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on that ID, otherwise it returns false. **I am not looking for comments on the usefulness of this function - it is
0
11572
by: Lysander | last post by:
Thought I would give something back with a few articles. This article is a bit of code to add error handling. When I have time, I want to write articles on multilingual databases, and Access Security, but I'll start with something short and simple This code was written in Access 2003 but should be valid in Access 2000 By default, when you start a new module, either in a form or report, or a global module, Access does not declare Option...
9
3285
by: MrDeej | last post by:
Hello guys! We have an SQL server which sometimes makes timeouts and connection errors. And we have an function witch writes and updates data in 2 tables on this server. When the SQL server error appears it, in 99%, of the cases, works if we just press the play button in VBA debug. Therefor we have maked an error handling which just tryes again. However, as this error handling is difficult to test because of maybe 1 or 2 errors a day, we...
0
7971
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...
1
8040
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8259
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
6698
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...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3889
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...
0
3932
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2408
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
1
1495
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.