ASP + XML

2007-06-13 8:15 pm
如果 用 ASP .. 有什麼 辦法 把 table D data export to XML ?!?!? (use oracle 8i)
更新1:

我用自己的PC 可以做到 export to XML 但點樣可以開一版新page. 叫個user save as the file name to his local ?!?!?!

回答 (1)

2007-06-14 1:30 pm
✔ 最佳答案
ASP has no internal function to transform data to XML format. You can do it with ASP.net using DataSet.GetXml method or DataSet.WriteXml method.

With classic asp, you have to write your own code to export data to xml. The link below is an example of writing a class to do the job in VB6. You can easily modify the code to fit in ASP pages or use the codes as is to create a dll and call the dll from your ASP page.

Download the codes from
http://www.freevbcode.com/ShowCode.Asp?ID=312

You mentioned Oracle 8i. Is the source data from Oracle? That should not make a difference. But the bottom line is you have to know ADO. Post the question if you have a problem connecting to Oracle data source and I'll try to answer you on that.

2007-06-15 00:35:57 補充:
Response.Addheader "Content-Disposition", "inline; filename=myfilename"Response.ContentType = "application/download"' Read data source and output the xml format into a stringResponse.Write outputString

2007-06-15 00:39:43 補充:
Do not put .xml extension to the filename or the xml will open in the browser instead of prompting the user to download the file.

2007-06-15 13:53:36 補充:
Do it this way you do not even need to create the physical xml file on the server and let the users download it.The prompt for download dialogue box will come up automatically when the page is rendered to the browser.


收錄日期: 2021-04-25 20:34:52
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070613000051KK01194

檢視 Wayback Machine 備份