Title: ADODB Stream

Hi Taco,

            I haven't not delved into your code. However, just a suggestion, perhaps create a VB COM dll which performs all you have listed below and returns the XML string to cold fusion.  I was struggling to directly call SQLDMO methods in CF and was having difficulties. So I wrote a VB COM DLL and called that in CF.

Theo

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Taco Fleur
Sent: Wednesday, 2 June 2004 3:39 PM
To: CFAussie Mailing List
Subject: [cfaussie] RE: ADODB Stream

 

Is there nobody that ever did this before?

A search for "adodb.stream xml +coldfusion" in Google also returns nothing....

-----Original Message-----
From: Taco Fleur
Sent: Wednesday, 2 June 2004 9:25 AM
To: CFAussie Mailing List
Subject: [cfaussie] ADODB Stream

Has anyone used an ADODB Stream to output XML directly form SQL server?

I'm trying to convert some ASP code into CF but its a pain, I have to set the constants that exist in ASP manually and I do not know each value or what they stand for exactly.

The following is what I am trying to convert:

Dim cnDB As ADODB.Connection
Dim cmSProc As ADODB.Command

set cnDB = new ADODB.Connection
cnDB.ConnectionString = connectionString
cnDB.CursorLocation = adUseClient
cnDB.Open

set cmSProc = new ADODB.Command
set cmSProc.ActiveConnection = cnDB
cmSProc.CommandType = adCmdStoredProc
cmSProc.CommandText = objSProc.Name

Dim strXML As String
Dim stXML As ADODB.Stream
Set stXML = New ADODB.Stream
stXML.open
cmSProc.Properties("Output Stream").Value = stXML
cmSProc.Parameters.Add(cmSProc.CreateParameter("@pFormId", adInteger, adParamInput, , FormId))

cmSProc.Execute , , (adExecuteStream + adCmdStoredProc)

strXML = stXML.ReadText(adReadAll)
strXML = <Root> & strXML & </Root>

 

This is what I have thus far

adUseClient = 1;
adCmdStoredProc = 1;
adInteger = 1;
adParamInput = 1;
FormId = 1;
adExecuteStream = 1;
adCmdStoredProc = 1;
adReadAll = 1;

connectionString = "Provider=SQLOLEDB;Server='168.153.43.6';Data Source=.;Initial Catalog=dbCCDB_development;User ID=#variables.username#;Password=#variables.password#";

cnDB = createObject("com", "ADODB.Connection");

cmSProc = createObject("com", "ADODB.Command");

cnDB.ConnectionString = connectionString;
cnDB.CursorLocation = adUseClient;
cnDB.Open();

cmSProc.ActiveConnection = cnDB;
cmSProc.CommandType = adCmdStoredProc;
cmSProc.CommandText = objSProc.Name;

stXML = createObject("com", "ADODB.Stream");
stXML.open();
cmSProc.Properties("Output Stream").Value = stXML;
cmSProc.Parameters.Add(cmSProc.CreateParameter("@pFormId", adInteger, adParamInput, null , FormId));
cmSProc.Execute( null ,null , (adExecuteStream + adCmdStoredProc));
strXML = stXML.ReadText(adReadAll);
strXML = "<Root> & strXML & </Root>";

This is the error I am getting at this stage (sure there are many more)
An exception occurred when executing a Com method. The cause of this exception was that: AutomationException: 0x80020005 - Type mismatch. in 'Provider'.

PS. I am aware that I can use SQL XML Support for IIS and output directly from MS SQL to the web, but thats not what I am after, I want to find a way to output XML created with FOR XML

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Register now for the 3rd National Conference on Tourism Futures, being held in Townsville, North Queensland 4-7 August - www.tq.com.au/tfconf

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
Register now for the 3rd National Conference on Tourism Futures, being held in Townsville, North Queensland 4-7 August - www.tq.com.au/tfconf

This message may contain privileged or confidential information and is intended only for the individual named. If you are not the named addressee you should not disclose, disseminate, distribute or copy this e-mail. If you have received this e-mail by mistake please notify the sender immediately by e-mail and delete this e-mail from your system. You should rely on your own virus checking programmes and procedures for checking any attachments. Please advise us if you wish your name and e-mail address to be removed from our database.


Reply via email to