update from disconnected recordset?!?

update from disconnected recordset?!?

Post by joe » Sat, 26 Aug 2000 04:00:00



Hi,

here is the code for saving on a floppy a recorset (in xml format):

<%
Set objconn = Server.CreateObject("ADODB.Connection")
objconn.open("provider=msdasql; driver={microsoft access driver (*.mdb)};
dbq=c:\inetpub\wwwroot\mydatabase.mdb")
strsql="select n1, n2 from mytable;"
set rs=objconn.execute(strsql)
rs.save "a:\floppy.xml", adPersistXML
rs.Close
%>

This works. Now the code for making some changes to the recordset on the
floppy:

<%
set rst = Server.CreateObject("ADODB.recordset")
rst.Open "a:\floppy.xml", "Provider=MSPersist;",3 ,3 , adCmdFile
rst.Find "n1 = 'Samson'"
If rst.EOF Then
response.write("Name not found")
else
rst.update "n2", "my change"
end If
rst.Save "a:\floppy2.xml", adPersistXML
rst.Close

This works too.
Here is my problem: how to update the original database ("mydatabase") by
the changes made on the disconnected recordset on the floppy? I tried this
but it doesn't work.

<%
Set objconn = Server.CreateObject("ADODB.Connection")
objconn.open("provider=msdasql; driver={microsoft access driver (*.mdb)};
dbq=c:\inetpub\wwwroot\mydatabase.mdb")
set rst = Server.CreateObject("ADODB.recordset")
rst.open "a:\floppy2.xml"
rst.activeconnection = objconn
rst.UpdateBatch
rst.Close
set objconn =nothing
set rst = nothing
%>

Any idea what's wrong or missing in this code?
Thanks
joe