Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: What's wrong with this code?


Message #1 by Alstom <Alstom@v...> on Sat, 14 Dec 2002 00:39:47 +0200
Please ignore my first post. 
It seems like the recordset's save method doesn't accept the "file:///"
syntax when referring to files. I've changed this to 'app.path &
"\personal.xml"' and now everythings works fine.

Regards,
Brad.



-----Original Message-----
From: Alstom 
Sent: Saturday, December 14, 2002 12:40 AM
To: professional vb
Subject: [pro_vb] What's wrong with this code?


With this procedure I'm reading a xml document into a recordset. I add a new
record to the recordset and save the recordset back to xml. 

Everything works fine (I can actually see during debugging the new record
gets added to the recordset) but the new record never gets written to the
xml file.

Can anyone please tell me what I do wrong? 

Here is my code:

  Dim xmldoc As MSXML.DOMDocument
  Dim Rs as ADODB.Recordset
    
    Set xmldoc = New MSXML.DOMDocument   'CreateObject("MSXML.DOMDocument")
    xmldoc.Load "file:///" & App.Path & "\Personal.xml"
   
    Set Rs = New ADODB.Recordset
    Rs.CursorLocation = adUseClient
    Rs.Open xmldoc, , adOpenDynamic, adLockOptimistic
    Rs.AddNew
    Rs!fname = Text1.Text
    Rs!lname = Text2.Text
    Rs.UpdateBatch
    
    
    Rs.save xmldoc, adPersistXML
    Rs.Close
    	
    Set Rs = Nothing
 
- Brad

DISCLAIMER : Volkswagen of South Africa (Pty) Ltd 
                 
Any views expressed in this message are those of the individual sender. 
No liability shall attach whatsoever to VWSA from this communication except 
where the sender is acting on specific authority of VWSA, such authority 
being public record and acknowledged by VWSA by nature of the employee's 
functions. This document may in no way be photocopied, printed, scanned or 
electronically duplicated for any purposes other than that for which it was
originally 
intended. 

If you are not the intended recipient of this communication, please discard 
this message and notify VWSA immediately at postmaster@v...


DISCLAIMER : Volkswagen of South Africa (Pty) Ltd 
                 
Any views expressed in this message are those of the individual sender. 
No liability shall attach whatsoever to VWSA from this communication except 
where the sender is acting on specific authority of VWSA, such authority 
being public record and acknowledged by VWSA by nature of the employee's 
functions. This document may in no way be photocopied, printed, scanned or 
electronically duplicated for any purposes other than that for which it was originally 
intended. 

If you are not the intended recipient of this communication, please discard 
this message and notify VWSA immediately at postmaster@v...

  Return to Index