Ask a Question related to ASP Database, Design and Development.
-
Vaibhav #1
Accessing SQL-Server data in XML
Dear all,
i want to access the the data from ms-sql-server2000 to xml file using asp so my
code is as
<%@ Language=VBScript %>
<!--#include file="adovbs.inc" -->
<%
Dim adoCmd 'As ADODB.Command
Dim adoConn ' As ADODB.Connection
Dim adoStreamQuery ' As ADODB.Stream
Dim outStrm ' As ADODB.Stream
Dim txtResults ' String for results
dim sConn ' String for connection
dim CmdStream ' as ADODB.Stream
Const adExecuteStream = 0
sConn = "Provider=SQLOLEDB;Data Source=TRIDT028;Initial Catalog=Northwind;uid=sa;pwd=trident"
'sConn = "Provider=SQLXMLOLEDB.3.0;Data Provider=SQLOLEDB;Data Source=TRIDT028;Initial Catalog=Northwind;uid=sa;pwd=trident"
Set adoConn = CreateObject("ADODB.Connection")
Set adoStreamQuery = CreateObject("ADODB.Stream")
adoConn.ConnectionString = sConn
adoConn.Open
Set adoCmd = CreateObject("ADODB.Command")
set adoCmd.ActiveConnection = adoConn
adoConn.CursorLocation = adUseClient
Set adoCmd.ActiveConnection = adoConn
sQuery = "<ROOT xmlns:sql='urn:schemas-microsoft-com:xml-sql'>"
sQuery = sQuery & "<sql:query>SELECT * FROM PRODUCTS FOR XML AUTO</sql:query>"
sQuery = sQuery & "</ROOT>"
adoStreamQuery.Open ' Open the command stream so it may be written to
adoStreamQuery.WriteText sQuery, adWriteChar ' Set the input command stream's text with the query string
adoStreamQuery.Position = 0 ' Reset the position in the stream, otherwise it will be at EOS
Set adoCmd.CommandStream = adoStreamQuery ' Set the command object's command to the input stream set above
adoCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}" ' Set the dialect for the command stream to be a SQL query.
Set outStrm = CreateObject("ADODB.Stream") ' Create the output stream
outStrm.Open
'adoCmd.Properties("Output Stream") = response ' Set command's output stream to the output stream just opened
adoCmd.Properties("Output Stream") = outStrm
adoCmd.Execute , , adExecuteStream ' Execute the command, thus filling up the output stream.
%>
but it is giving the error
ADODB.Command (0x800A0CB3)
Object or provider is not capable of performing requested operation.
if i will use the SQLXMLOLEDB as provider and OLEDB as data provider
then it is giving the error
SQLXMLOLEDB Provider command object can only execute to a stream.
so please suggest me the solution.
thanking u
vaibhav
Vaibhav Guest
-
Accessing XMLConnector's data
Hi there, Pls kindly help me with a XMLConnector's problems. I have an XML file successfully read into XMLConnector as following: results:XML... -
Accessing data from an MS Access database on a remote web server
Please forgive me if I have posted this to the wrong group! I have written a VB6 application that works fine. With that said, I would like to add... -
Accessing the XML Connector Data
Once I have XML data loaded and a XML schema loaded.... how is the data accessed(pathed) in ActionScript? Binding the data to other v2 components... -
Accessing Data
Hi Friends, Is there a way to access data from a website that displays its data from a database. For example if i visit... -
Accessing data on a SQL-server
I want to make an Aspx-page, where a user can enter a username and a loginname. I have create all parts execpt for the databaseconnection. ...



Reply With Quote

