Saving query results from browser to a local file

Results 1 to 2 of 2

Thread: Saving query results from browser to a local file

  1. #1
    Rittu Guest

    Default Saving query results from browser to a local file

    Hi,<BR><BR>I would really like some help on this one!<BR><BR>I have created a .asp file that queries a database and outputs the<BR>results in an HTML table on the browser(Netscape). I would like to add the functionality<BR>where I could save these results to a local file on the client by<BR>clicking on a "SAVE" button, for example.<BR><BR>Is it possible to pull these query results into an Excel spreadsheet and<BR>manipulate the data on the client? Note: Only Netscape will be used. Can you still open up excel directly from the asp page?<BR><BR>Thanks in advance,

  2. #2
    Join Date
    Dec 1969

    Default RE: Saving query results from browser to a local f

    I am doing the very thing you mention. To do it the SAVE button is the SUBMIT of a form that has no INPUT field and executes a savexyz.asp script. If you need to pass variable to savexyz.asp, usae HIDDEN fields in the form. Then in savexyz.asp the first line of the script should be:<BR>&#060;%Response.ContentType = "application/ excell"%&#062;<BR> The rest of the script should retrieve the data from the DataBase, the HIDDEN fields or whereever) and write out rows in the form of:<BR>&#060;%Response.Write "data" & Chr(9) & "data" & Chr(9) & "data" & Chr(10)%&#062;<BR> The "data" might be RS(0) or RS("first_name") for example.<BR> Chr(9) is horizontal tab, Chr(10) is newline. Tab to separate columns, newline to separate rows.<BR><BR> When this is executed, you should get a SAVE-As box that allows you to download the rows created to a local folder.<BR> Then in Excel you can use that file as tab delimited input.<BR>Just execute Excel and open the downloaded file. It will lead you throught a dialog where you tell it about the file(That it is tab delimited, basically) and then import it in as an Excel spreadsheet.

Posting Permissions

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