Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:17 PM
Niraj Khandwala
Guest
 
Posts: n/a
Default 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!
  #2  
Old July 19th, 2005, 02:19 PM
Niraj Khandwala
Guest
 
Posts: n/a
Default Re: ASP Error Handling

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!
  #3  
Old July 19th, 2005, 02:24 PM
Niraj Khandwala
Guest
 
Posts: n/a
Default Re: ASP Error Handling

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!
  #4  
Old July 19th, 2005, 02:27 PM
Niraj Khandwala
Guest
 
Posts: n/a
Default Re: ASP Error Handling

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!
  #5  
Old July 19th, 2005, 02:27 PM
Chris Hohmann
Guest
 
Posts: n/a
Default Re: ASP Error Handling

"Niraj Khandwala" <kniraj@vsnl.net> wrote in message
news:eoJaGhAdEHA.3020@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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![/color]

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.


  #6  
Old July 19th, 2005, 02:27 PM
Niraj Khandwala
Guest
 
Posts: n/a
Default Re: ASP Error Handling

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!
  #7  
Old July 19th, 2005, 02:28 PM
Chris Hohmann
Guest
 
Posts: n/a
Default Re: ASP Error Handling

"Niraj Khandwala" <kniraj@vsnl.net> wrote in message
news:uxkTvVudEHA.3132@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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[/color]

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.


  #8  
Old July 19th, 2005, 02:29 PM
Niraj Khandwala
Guest
 
Posts: n/a
Default Re: ASP Error Handling

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!
  #9  
Old July 19th, 2005, 02:29 PM
Chris Hohmann
Guest
 
Posts: n/a
Default Re: ASP Error Handling

"Niraj Khandwala" <kniraj@vsnl.net> wrote in message
news:uukT5yIeEHA.1000@TK2MSFTNGP12.phx.gbl...[color=blue]
> 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[/color]

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.


 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles