p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   XML (http://p2p.wrox.com/xml-91/)
-   -   writing to an xml file on the client side (http://p2p.wrox.com/xml/27591-writing-xml-file-client-side.html)

Toran April 1st, 2005 05:50 PM

writing to an xml file on the client side
 
ok .. I need help (once more)
I create a report in the following script fed by an Access Database.
My goal is to give the client the option to save this report as an xml file locally so it can update the clients Database (via import)
how do i write from the server to the clients harddrive? Is there a way to write directly to the clients harddrive? or do i create a file for download on the server?

Toran



<%option explicit%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
    <title>Client Report</title>

    <%
    dim objCommand, objRS
        Set objCommand = Server.CreateObject("ADODB.Command")
        objCommand.ActiveConnection = strConn
        objCommand.CommandText = "Select FirstName, Name, City, Sales.SalesID, SalesDate, SalesTime, Client.ClientID "
        objCommand.CommandText = objCommand.CommandText + "FROM Client, Sales, SalesLine "
        objCommand.CommandText = objCommand.CommandText + "WHERE Client.ClientID= Sales.ClientID AND Sales.SalesID= SalesLine.SalesID "
        'executing and resetting to Nothing
        objCommand.CommandType = adCmdText
        Set objRS = objCommand.Execute
        Set objCommand = Nothing
    %>
</head>

<body>
Sales Reports:
<%

response.write "<table border ='1'>"
response.write "<tr><th colspan='4'>Clients</th></tr>"
if not (objRS.eof) then

    objRS.moveFirst
    while not objRS.eof

    response.write "<tr><td>"&objRS("ClientID")&"</td><td>"&objRS("FirstName")&"</td><td>"&objRS("Name")&"</td><td>"&objRS("City")&"</td>"
    response.write "<td>"&objRS("SalesID")&"</td><td>"&objRS("SalesDate")&"</td><td>"&objRS("SalesTime")

    objRS.movenext
    wend

else

response.write "NOTHING HERE"
End if
response.write "</table>"
%>
</body>
</html>


... there is always more to learn...

... there is always more to learn...

joefawcett April 2nd, 2005 05:32 AM

You can only wite to the hard drive if the client has low security settings and the code executes client side. An alternative is to produce the file server side and give a link to the file with instructions to right click on the link and choose "save target as..." for IE or whatever the text is for other browsers. Otherwise the xml will simply dispaly in the browser.

--

Joe (Microsoft MVP - XML)

Toran April 2nd, 2005 03:51 PM

thanks ... umph ... it kinda sucks but makse sense. Anyways i have tried to create the file on the server (currently localhost for testing) and IE hangs. So can anyone show me into the direction to create my report as an xml file on the server and the download process? Much appreciated

... there is always more to learn...

... there is always more to learn...


All times are GMT -4. The time now is 02:49 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.