Is it possible in ASP to ...

Results 1 to 3 of 3

Thread: Is it possible in ASP to ...

  1. #1
    Join Date
    Dec 1969
    Posts
    866

    Default Is it possible in ASP to ...

    I am trying to find out, is it possible to write the output(database query results) into a textfile from the ASP page. If possible how can I accomplish this?<BR><BR>Thanks<BR>Sam

  2. #2
    Stephan Zutterman Guest

    Default RE: Is it possible in ASP to ...

    Yes it is, with the FileSystemObject, included with IIS 4.0!<BR><BR>Here&#039s a code sample (I assume you have the database query open and you called the recordset object rs) that will write a text file with all records of the open recordset, one line for each record:<BR>&#060;%<BR>Dim FileObject, Instream, TextLine<BR>Set FileObject = CreateObject("Scripting.FileSystemObject")<BR>Set Instream = FileObject.CreateTextFile (Server.MapPath("/Path") & "/File.Txt", True)<BR>do while not rs.eof<BR> Instream.WriteLine rs("field") & ";" & rs("field2")<BR> rs.movenext<BR>loop<BR>Instream.Close<BR>Set Instream = Nothing<BR>Set FileObject = Nothing<BR>%&#062;<BR><BR>Greetings,<BR><BR>Stepha n

  3. #3
    Join Date
    Dec 1969
    Posts
    866

    Default RE: Is it possible in ASP to ...

    Thanks a lot. It works.<BR><BR>Sam.

Posting Permissions

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