RE: Creaet XML file from recordset
From: StephenMcC (StephenMcC_at_discussions.microsoft.com)
Date: 11/23/04
- Next message: Norm Cook: "Re: access - ole object - using vb"
- Previous message: Ralph: "Re: DLL Names"
- In reply to: shachar: "Creaet XML file from recordset"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 23 Nov 2004 06:45:02 -0800
Hi Shachar,
There are a number of ways to do this, one idea may be to iterate thru the
RecordSet creating the xml file from the returned field names and values, ie:
....
....
Dim sXML as string
sXML = "<Records>"
....
'Create and Open ur RecSet
....
Do While Not oRS.EOF
sXML = sXML & "<Record>"
Do While i < rs.Fields.Count
sXML = sXML & "<" & rs.Fields(i).Name & ">" & _
rs.Fields(i).Value & _
"</" & rs.Fields(i).Name & ">"
'U could alos reference fields thru their index/name and
'provide ur own custom tage names containing the values.
Loop
sXML = sXML & "</Record>"
Loop
sXML = sXML & "<Records>"
....
close ur RecSet and release objects etc
....
The codes a bit rough and ready but it should get u going. Another idea may
be to create vb objects which are populated from the recordset, then do a
serialise on private members with the obj to generate the xml.
You can get more info on ADO and RecordSets below:
http://msdn.microsoft.com/library/en-us/dnado/html/workshp2.asp?frame=true#workshp2_topic4
http://msdn.microsoft.com/library/en-us/adosql/adoprg02_9cfn.asp?frame=true
Stephen.
"shachar" wrote:
> hi all.
> i'm new with xml, and i want to create an xml file from
> my recordset object.
> BUT i dont want to use the "save" method with
> adPersistXML because i must control the data, so i can
> manipulate it.
> i'm looking for a simple starter example of how to do it
> (mabe with MsXml object?)
> thanks - shachar.
>
>
- Next message: Norm Cook: "Re: access - ole object - using vb"
- Previous message: Ralph: "Re: DLL Names"
- In reply to: shachar: "Creaet XML file from recordset"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|