SQLXML code sample in ASP

DETAILS

<%

Response.ContentType = "text/xml"
Dim oCmd, sSQL 

sSQL = "<root><sql:query xmlns:sql='urn:schemas-microsoft-com:xml-sql'>" & _
       "Select Lastname, Firstname, City from Employees order by Firstname FOR XML AUTO </sql:query></root>" 

Set oCmd = Server.CreateObject("ADODB.Command")
oCmd.ActiveConnection = ("Provider=sqlxmloledb.3.0;data provider=sqloledb;Data Source=SQL Server;user id=SQL user;password=password;Initial Catalog=database") 

oCmd.CommandText = sSQL
oCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}" 

oCmd.Properties("Output Stream") = Response
oCmd.Execute , , 1024 

Set oCmd = Nothing

%>

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Send mail using CDO

DETAILS<% set objMessage = createobject("cdo.message")set objConfig =...

Query SQL database with .NET SQL Data Provider in ASP.NET

DETAILS<%@ import namespace="system.data.sqlclient" %><Script...

Query an Access database with ASP using a DSN-less connection.

DETAILS<%Dim cnnSimple  ' ADO connectionDim rstSimple  ' ADO recordsetSet cnnSimple...

Query MySQL database in ASP

DETAILS<%Dim cnnSimple  ' ADO connectionDim rstSimple  ' ADO recordsetSet cnnSimple...

Query MS Access Database with OleDB in ASP.net

DETAILS<%@ import namespace="system.data.oleDb" %><Script...

Powered by WHMCompleteSolution