Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Newbie question on error checking

Reply
Thread Tools

Newbie question on error checking

 
 
rich
Guest
Posts: n/a
 
      01-30-2006
Hello,

I am fairly new to ASP code and need help with error checking within my
script.

Specifically, I need to check for 3 things:

1. Trap the error if the script cannot find or connect to Active Directory.
2. Trap the error if the script cannot find the requested FSM Group.
3. Trap the error if the required input file is missing or it cannot create
or edit the output file.

I have learned a little about using the Err Object (Err.number and
Err.description) but that is about it. Can anyone offer me any general
tips/tricks about how best to do this or point me to some good reference
material?

Thanks in advance,

Rich
 
Reply With Quote
 
 
 
 
Chi
Guest
Posts: n/a
 
      02-01-2006
When you make connections to Database its good practice to put them all
within a try / catch statement as follows...

Try
'Open connection and perform what you need don
Catch ex As Exception
'Write code here to catch any errors and perform anything
that you want to perform if the code hits an error.
(example...)
Dim strError as string = ex.Message 'This will write
the error to the strError
End Try

Dont forget to close connections. Look at MSDN for Try/Catch Statements if
you need further info. But I believe its the Try/Catch is what you are
looking for.


"rich" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I am fairly new to ASP code and need help with error checking within my
> script.
>
> Specifically, I need to check for 3 things:
>
> 1. Trap the error if the script cannot find or connect to Active
> Directory.
> 2. Trap the error if the script cannot find the requested FSM Group.
> 3. Trap the error if the required input file is missing or it cannot
> create
> or edit the output file.
>
> I have learned a little about using the Err Object (Err.number and
> Err.description) but that is about it. Can anyone offer me any general
> tips/tricks about how best to do this or point me to some good reference
> material?
>
> Thanks in advance,
>
> Rich



 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      02-01-2006
This user is likely using vbscript in a .asp page, not VB.Net in a .aspx
page, given that he posted in a classic asp group and mentioned the vbscript
Err object.
Chi wrote:
> When you make connections to Database its good practice to put them
> all within a try / catch statement as follows...
>
> Try
> 'Open connection and perform what you need don
> Catch ex As Exception
> 'Write code here to catch any errors and perform
> anything that you want to perform if the code hits an error.
> (example...)
> Dim strError as string = ex.Message 'This will
> write the error to the strError
> End Try
>

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      02-01-2006
rich wrote:
> Hello,
>
> I am fairly new to ASP code and need help with error checking within
> my script.
>
> Specifically, I need to check for 3 things:
>
> 1. Trap the error if the script cannot find or connect to Active
> Directory.
> 2. Trap the error if the script cannot find the requested FSM Group.
> 3. Trap the error if the required input file is missing or it cannot
> create or edit the output file.
>
> I have learned a little about using the Err Object (Err.number and
> Err.description) but that is about it. Can anyone offer me any
> general tips/tricks about how best to do this or point me to some
> good reference material?
>

I somehow missed this question the first time around. Are you still here?

Actually, what you've learned is pretty much all there is for error-handling
in vbscript:

'turn on error-handling
on error resume next
'do something whose error you wish to trap
if err <> 0 then
'handle the error
end if
'turn off error-handling
on error goto 0

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
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
Checking to see if a file is open (newbie)? Thomas Luedeke Ruby 1 07-30-2008 10:24 PM
Newbie : checking semantics LDD Python 25 05-17-2005 10:11 AM
OE6: Spell checking error question Brian S. Computer Support 0 03-05-2004 07:27 AM
dumb newbie question (or newbie dumb question) Jerry C. Perl Misc 8 11-23-2003 04:11 AM
Checking for an "undefined" variable - newbie question Dan Rawson Python 7 08-06-2003 02:08 PM



Advertisments