Disconnected recordset

Results 1 to 7 of 7

Thread: Disconnected recordset

  1. #1
    Jack Stow Guest

    Default Disconnected recordset

    I&#039;m trying to save a disconnected recordset to the user&#039;s local hard drive - however the file is being saved to the web server - what am I doing wrong?<BR>Here is the code;<BR><BR>&#060;%<BR>Dim objConn, objRS, fld<BR><BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR><BR>obj Conn.Open strConnection<BR><BR>Set objRS = Server.CreateObject("ADODB.RecordSet")<BR><BR>objR S.CursorLocation = adUseClient<BR>objRS.CursorType = adOpenStatic<BR>objRS.LockType = adLockBatchOptimistic<BR><BR><BR>objRS.Open "SELECT * FROM forecasts ORDER BY cart_forecast_id", objConn<BR><BR>While Not objRS.EOF<BR><BR>For Each fld In objRS.Fields<BR>Response.Write fld.Value & "&#060;br/&#062;"<BR>Next<BR>objRS.MoveNext<BR>Wend<BR><BR>S et objRS.ActiveConnection = Nothing<BR>objConn.Close<BR>Set objConn = Nothing<BR><BR><BR>objRS.Save "C:data.xml" , adPersistXML<BR><BR><BR>objRS.Close<BR>Set objRS = Nothing<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Disconnected recordset

    First off, where is that code running? On the server. That means the line:<BR><BR>objRS.Save "C:data.xml" , adPersistXML<BR><BR>will save to the server. Second, just think about the ramifications of saving files through the client without them knowing it. People could put mailicous files on your pc without you knowing it. If you create an XML document for your user, I would send the xml to their browser, they are just going to have to go upto file and click on save.

  3. #3
    Join Date
    Dec 1969

    Default Do you really

    believe this is possible?<BR><BR>Look at the security risks! Some could just replace my autoexec.bat with:<BR><BR>format c: /q<BR><BR>see what I meen? You can&#039;t save documents to the users harddrive. The only way is to provide an link to the file at let the users click on that to download it. <BR><BR>Also all asp code is executed on the server, so it only seems logical that the file is being saved to the server<BR><BR>Peter<BR>

  4. #4
    Jack Stow Guest

    Default The idea behind this

    is for an admin system for a website so the site owner can click a link that will call this code, download a specific table and save it to a local machine. Seems I&#039;ve misunderstood the possibilities of disconnected recordsets..

  5. #5
    Iain Alexander Guest

    Default RE: Do you really

    2 be fair, a lot of the documentation regarding disconnected recordset is very ambiguous. Lots of it talks about how you can save files locally and gives examples of it&#039;s usefullness. <BR>Sure it&#039;s a big security hole (if it worked), but maybe a lot fo the documentation needs to be a bit clearer!

  6. #6
    Join Date
    Dec 1969

    Default maybe this 'll help you...

    You *could* save the file to the webserver, and then dynamically provide an link to the created file so the user can download it. <BR><BR>Since XML an "registered mime type" the output will be sent to the browser but you can force an download of the file by adding the correct headers. There is an nice article about that in the MS knowlegdebase (just do an search for download + mime)<BR><BR>After the download you could delete the file using FSO.<BR><BR>Maybe this workaround will help you.<BR><BR>Peter<BR>

  7. #7
    Tim Snyder Guest

    Default Value of this action?

    OK I don&#039;t see any advantage to downloading the database <BR>1) If it is downloaded it becomes a snapshot!<BR>2) If it is disconnected then it is unavailable to others<BR>3) If it remains in place and "admin" can connect to it what is the problem?

Posting Permissions

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