Printing out a database query

Results 1 to 2 of 2

Thread: Printing out a database query

  1. #1
    Join Date
    Dec 1969
    Posts
    13

    Default Printing out a database query

    I need to print out the results of a database query and I&#039m not sure how to go about it. Ideally I&#039d have a button that says "print it" and then you just pick up your report. Do I somehow direct the information to a text file and then get that to print out? I&#039m guessing that this needs to be done on the server side. Any help is appreciated.

  2. #2
    SamJ Guest

    Default RE: Printing out a database query

    You can save the results of a query to a text file. You have to use the Scripting.FileSystemObject though. Here is an example?<BR><BR>fileName = "d:directoryText_File.txt"<BR>Set fs = Server.CreateObject("Scripting.FileSystemObject")< BR>Set MyFile = fs.CreateTextFile(fileName)<BR><BR>Set cn = Server.CreateObject("ADODB.Connection")<BR>strLine ="" <BR>MyFile.writeline strLine<BR>Do while Not rstemp.EOF<BR>strLine=""<BR>for each x in rstemp.Fields<BR>strLine= strLine & trim(x.value) & chr(9)<BR>next<BR>MyFile.writeline strLine<BR>rstemp.MoveNext<BR>Loop<BR><BR>Or you could format it nicely in HTML and then have them print that. I guess it depends on what the users want to do with it.

Posting Permissions

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