Classic Asp Error Object

What, then, do we want to do if there is an error? Your boss types in his name, "The Pointy Haired Boss," and hits the submit button. Let's work to help developers, not make them feel stupid. If exists just append to it Set WriteMyData = ObjMyFile.OpenTextFile(LogFileDirectory & "\" & LogFileName,8,True) RowHeaderString = Session("User_ID") & vbTab RowHeaderString = RowHeaderString & Session("Username") & vbTab RowHeaderString = RowHeaderString & NOW

Let's start by using the only command that ASP has to help us - On Error Resume Next. Asp On Error Goto This should be less confusing for the user and you. Posted 15-Jun-12 17:26pm Bhavana P737 Add a Solution 2 solutions Top Rated Most Recent Rate this: Please Sign up or sign in to vote. Here is an example:

If Err.Number = 0 And objConnection.Errors.Count = 0 Then ' OK to redirect Response.Clear Response.Redirect "" End If

Making the Code

Instead, use On Error Resume Next and then check both Err.Number and the Count property of the Errors collection, as shown in the following example: Copy

Other Stuff How To Use On Error Resume Next Often when using ASP or Active Server Pages with VBScript you will find it necessary to check for errors when w3schools.com THE WORLD'S LARGEST WEB DEVELOPER SITE ☰ HTML CSS JAVASCRIPT SQL PHP BOOTSTRAP JQUERY ANGULAR XML   TUTORIALS REFERENCES EXAMPLES FORUM × HTML and CSS Learn HTML Learn CSS See more: ASP What are the ways in which error handling can be done in Classic ASP? useful reference He was entirely right.

Used with Recordset.Open or Requery only. On Error Resume Next Vbscript What happens to Batgirl after The Killing Joke? Be yourself.

Copyright 1999-2016 by Refsnes Data. adExecuteRecord Indicates that the CommandText is a command or stored procedure that returns a single row which should be returned as a Record object. ❮ Complete Connection Object Reference COLOR Active Server Pages help tutorial how to ASP Help ASP Tutorials ASP Programming ASP Code - ASP Free CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com

ActiveX Data Objects (ADO) Error Handling Handling Errors In Other Languages Handling Errors In Other Languages Handling Errors in VBScript Handling Errors in VBScript Handling Errors in VBScript Handling Errors in Which is actually what I would have expected from the code you showed in the first post. current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list. http://tutorialswitch.com/on-error/asp-database-connection-error-handling.php Set cnn1 = Server.CreateObject("ADODB.Connection") cnn1.Open "nothing" If cnn1.Errors.Count > 0 Then ' Enumerate Errors collection and display ' properties of each Error object.