473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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.GetLastError() 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.GetLastError 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 3677
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.net> wrote in message
news:eo**************@TK2MSFTNGP11.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.GetLastError 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.net> wrote in message
news:ux**************@TK2MSFTNGP11.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.GetLastError 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.OpenTextFile(strFileName)
con.BeginTrans
On Error resume next
do while oTs.AtEndOfStream = 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.net> wrote in message
news:uu**************@TK2MSFTNGP12.phx.gbl...
hey, Chris thanks,

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

Sample code :
----------------------------------------
set oTs = oFs.OpenTextFile(strFileName)
con.BeginTrans
On Error resume next
do while oTs.AtEndOfStream = 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.Connection.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>Connection.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
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...
12
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...
6
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...
13
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...
21
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...
3
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...
4
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...
10
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...
0
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...
9
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.