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 MySQL database in ASP

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

Send Email in ASP.NET

DETAILS<%@ Page Language="VB" %><script...

Query a SQL database with ASP using a DSN-less connection

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

Redirect a subdomain to a subdirectory

DETAILS You can redirect a subdomain to a subdirectory by using ASP or ASP.net...