Retrieving XML from SQL Server 2000 using an ado connection object

Retrieving XML from SQL Server 2000 using an ado connection object

Post by aleph-zer » Thu, 05 Oct 2000 04:00:00



Until now I have been using ADO recordset to retrieve content from an sql
server database for use in asp pages. I have been making all updates to the
database in a page initialisation procedure and then I rely on the fact that
I'm using the same ado connection object everywhere in the page to ensure
that the updated records are used when generating my pages.

I am moving towards replacing the html generated from recordsets with XML
and XSL stylesheets, but I have not been able to find a neat way of ensuring
updates to the database are incorperated in XML when generating my pages.
Using the IIS virtual directory template query I can generated the XML I
require, but I think I need to generate the XML from the ado connection
object to ensure page updates are encorperated.

I have looked briefly at the ado recordset save function, but thought there
must be a neater way of doing this.

Does anyone know if there is:
1. A method to generate the xml definited in a template query such as
"http://myserver/myvdir/myquery.xml" from an ado connection
2. Another suitable method for updating a database then generating xml
incorperating the updates.

Thanks

 
 
 

Retrieving XML from SQL Server 2000 using an ado connection object

Post by Roger Wolte » Fri, 06 Oct 2000 04:00:00


I'm not completely clear as to what you are trying to do but you could use
your ADO connection to submit "FOR XML" queries (assuming you are using SQL
2000) and stream the results to the response object.  If you are not using
SQL 2000 then the recordset save function is probably your best alternative.


Quote:> Until now I have been using ADO recordset to retrieve content from an sql
> server database for use in asp pages. I have been making all updates to
the
> database in a page initialisation procedure and then I rely on the fact
that
> I'm using the same ado connection object everywhere in the page to ensure
> that the updated records are used when generating my pages.

> I am moving towards replacing the html generated from recordsets with XML
> and XSL stylesheets, but I have not been able to find a neat way of
ensuring
> updates to the database are incorperated in XML when generating my pages.
> Using the IIS virtual directory template query I can generated the XML I
> require, but I think I need to generate the XML from the ado connection
> object to ensure page updates are encorperated.

> I have looked briefly at the ado recordset save function, but thought
there
> must be a neater way of doing this.

> Does anyone know if there is:
> 1. A method to generate the xml definited in a template query such as
> "http://myserver/myvdir/myquery.xml" from an ado connection
> 2. Another suitable method for updating a database then generating xml
> incorperating the updates.

> Thanks


 
 
 

Retrieving XML from SQL Server 2000 using an ado connection object

Post by Michael Ry » Fri, 06 Oct 2000 04:00:00


You can use templates through ADO as follows:

Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim strmIn As New ADODB.Stream
cn.Open sConn
Set cmd.ActiveConnection = cn
strmIn.Open
strmIn.WriteText "template"
strmIn.Position = 0
Set cmd.CommandStream = strmIn
cmd.Dialect =
       "{5d531cb2-e6ed-11d2-b252-00c04f681b71}"
cmd.Properties("Output Stream").Value = Response
cmd.Execute , , adExecuteStream

when connecting to SQLServer 2000.

For updates you have several possibilities depending on your application
requirements:

1. Use SQL Stored procs/update statements to perform the updates
2. Use OpenXML in a SQL stored proc

both work with SS2000 as released. In addition with the upcoming webrelease
(current release on msdn only works with beta2 build of SS2000),

3. XML Updategrams

I hope this helps
Michael


Quote:> Until now I have been using ADO recordset to retrieve content from an sql
> server database for use in asp pages. I have been making all updates to
the
> database in a page initialisation procedure and then I rely on the fact
that
> I'm using the same ado connection object everywhere in the page to ensure
> that the updated records are used when generating my pages.

> I am moving towards replacing the html generated from recordsets with XML
> and XSL stylesheets, but I have not been able to find a neat way of
ensuring
> updates to the database are incorperated in XML when generating my pages.
> Using the IIS virtual directory template query I can generated the XML I
> require, but I think I need to generate the XML from the ado connection
> object to ensure page updates are encorperated.

> I have looked briefly at the ado recordset save function, but thought
there
> must be a neater way of doing this.

> Does anyone know if there is:
> 1. A method to generate the xml definited in a template query such as
> "http://myserver/myvdir/myquery.xml" from an ado connection
> 2. Another suitable method for updating a database then generating xml
> incorperating the updates.

> Thanks

 
 
 

Retrieving XML from SQL Server 2000 using an ado connection object

Post by aleph-zer » Sat, 07 Oct 2000 04:00:00


Thanks, that's just what I needed,

John

 
 
 

1. Retrieving data from Exchange 2000 server using ado/ado.net

I am trying to make an application on a client machine
that will retrieve Outlook Calendar data from a Exchange
2000 Server. I have looked at several ways to do this
(making a webservice on the exchange server, using exoledb
or webdav and so on).

The solution i've found most suitable and interesting, is
using MSDAIPP.DSO as a ADO connection provider to retrieve
information with http:// URL. However I have only seen how
to do this with ADO, not ADO.NET. It is a bit troublesome
to use ADO in .NET and i'm not that familiar with it
either.

Does anyone know if it is possible to use MSDAIPP.DSO in
conjunction with ADO.NET, or if there is some other way to
retrieve data with ADO.NET from Exchange 2000 server? If
so, how is this done?

All help appreciated!

Regards
Jan Johansen

2. Could not add the table 'Select' Error

3. retrieve primary key after insert statement (using ADO / SQL Server 2000)

4. sql agent vbscript

5. Problem with ADO Stream retrieving XML from SQL 2000 in VBScript

6. Problem with Logfilsiz/Logprimary - can′t connect to DB

7. Most efficient way to retrieve XML from SQL Server 2000

8. Help Recover Database Space

9. Problem using VB to retrieve ASP/XML using ADO recordset

10. Help using OPENXML to retrieve specific elements for use in SQL insert (SQL*Server 2000)

11. Migration from Pervasive SQL 2000 to MS-SQL Server 2000 using ADO

12. Letter Server using XML & Sql Server 2000

13. Sql 2000 for Xml vs Ado Xml persistance