pro_vb thread: VB, XML, datasources, and a smiley face.
Message #1 by "Nikolai Devereaux" <yomama@u...> on Mon, 16 Jul 2001 12:15:34 -0700
|
|
It is possible with an ADO recordset, only with a (small?) work around.
To use this you need to have the schema of the recordset you want to create.
What I did was create a normal recordset and save it as xml then you have
the namespace and schema. In the example below I have stored them in csXML
and csSchema.
Dim adoCmd As ADODB.Command
Dim adoStream As ADODB.Stream
Dim adoStream2 As ADODB.Stream
Dim sSQL As String
Dim RS As ADODB.Recordset
sSQL = "SELECT * FROM Authors FOR XML AUTO"
Set adoStream = New ADODB.Stream
adoStream.Open
Set adoCmd = New ADODB.Command
adoCmd.ActiveConnection = YourConnectionHere
adoCmd.CommandText = sSQL
adoCmd.Properties("Output Stream") = adoStream
adoCmd.Execute , , adExecuteStream
Set adoStream2 = New ADODB.Stream
adoStream2.Open
adoStream2.WriteText csXML & csSchema
adoStream2.WriteText "<rs:data>" & adoStream.ReadText &
"/rs:data></xml>"
adoStream2.Position = 0
Set RS = New ADODB.Recordset
RS.Open adoStream2
good luck,
Peter
Software Engineer / Trainer
Vervoorn IT
----- Original Message -----
From: "Nikolai Devereaux" <yomama@u...>
To: "professional vb" <pro_vb@p...>
Sent: Monday, July 16, 2001 11:18 PM
Subject: [pro_vb] RE: VB, XML, datasources, and a smiley face.
> No, because that would mean having to save the query result to a file
first.
>
> > -----Original Message-----
> > From: Tim Mccurdy [mailto:tmccurdy@c...]
> > Sent: Monday, July 16, 2001 1:29 PM
> > To: professional vb
> > Subject: [pro_vb] RE: VB, XML, datasources, and a smiley face.
> >
> >
> > Did you try opening it with an ADO Recordset?
> >
> > Dim AdoRst As New ADODB.Recordset
> > AdoRst.Open "C:\Ado.xml"
> >
> > -----Original Message-----
> > From: Nikolai Devereaux [mailto:yomama@u...]
> > Sent: Monday, July 16, 2001 3:16 PM
> > To: professional vb
> > Subject: [pro_vb] VB, XML, datasources, and a smiley face.
> >
> >
> >
> > If I have MSSQL server return an XML document as the result of a query,
is
> > there an OLEDB provider that can interpret and present that XML data as
a
> > datasource?
> >
> > Thanks in advance =)
> >
> > Nik
|