How do I get FSO to put my error values into a .tx

Results 1 to 2 of 2

Thread: How do I get FSO to put my error values into a .tx

  1. #1
    Join Date
    Dec 1969

    Default How do I get FSO to put my error values into a .tx

    Hi All I have a .txt file that I want all my error information to go into. Im able to append the file, but how do I get it to write the data that has just been created from my asp file?<BR><BR>Do I use something other than <BR>objTextStream.WriteLine<BR><BR>The error properies I want to write to it are in the code below.<BR><BR>Any help is much appreciated.<BR><BR><BR>Code<BR>&#060;%<BR>Set cnn1 = Server.CreateObject("ADODB.Connection")<BR>On Error resume Next<BR><BR>&#039; Intentionally trigger an error.<BR>cnn1.Open "nothing"<BR><BR>If Err Then<BR><BR>Const fsoForAppend = 8<BR><BR>Dim objFSO<BR>Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR><BR>&#039;Open the text file<BR>Dim objTextStream<BR>Set objTextStream = objFSO.OpenTextFile("D:myerrorapperrors.txt", fsoForAppend)<BR><BR>&#039;Display the contents of the text file<BR>objTextStream.WriteLine "Hello, World!"<BR>objTextStream.WriteLine "This is fun!!"<BR><BR>&#039;I want the these values to be written to the text file<BR>&#039; Response.Write "&#060;p&#062;&#060;b&#062;VBScript Err Object:&#060;/b&#062;<BR>" & _<BR>&#039; "Number: " & Err.Number & "<BR>" & _<BR>&#039; "Description: " & Err.Description & "<BR>" & _<BR>&#039; "Source: " & Err.Source & "<BR>" & _<BR>&#039; "HelpFile: " & Err.HelpFile & "<BR>" & _<BR>&#039; "HelpContext: " & Err.HelpContext & "&#060;/p&#062;"<BR><BR>&#039;Close the file and clean up<BR>objTextStream.Close<BR>Set objTextStream = Nothing<BR>Set objFSO = Nothing<BR> <BR> Next<BR>End If<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default So why didn't you just try it???

    But in a text file, you would want to use vbNewLine instead of &#060;br/&#062;.<BR><BR>Or you would write each one separately with WriteLine.<BR><BR>&#039;I want the these values to be written to the text file<BR>objTextStream.Write "VBScript Err Object:" & vbNewLine & _<BR> "Number: " & Err.Number & vbNewLine & _<BR> "Description: " & Err.Description & vbNewLine & _<BR> "Source: " & Err.Source & vbNewLine & _<BR> "HelpFile: " & Err.HelpFile & vbNewLine & _<BR> "HelpContext: " & Err.HelpContext & vbNewLine & vbNewLine<BR><BR>OR:<BR><BR>objTextStream.WriteLin e "VBScript Err Object:" <BR>objTextStream.WriteLine "Number: " & Err.Number <BR>objTextStream.WriteLine "Description: " & Err.Description <BR>objTextStream.WriteLine "Source: " & Err.Source <BR>objTextStream.WriteLine "HelpFile: " & Err.HelpFile <BR>objTextStream.WriteLine "HelpContext: " & Err.HelpContext<BR>objTextStream.WriteLine ""<BR><BR><BR><BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts