Thread View: pl.comp.xml
1 messages
1 total messages
Started by TOUDIdel
Mon, 19 Nov 2007 20:46
[BTW] SQL -> XML
Author: TOUDIdel
Date: Mon, 19 Nov 2007 20:46
Date: Mon, 19 Nov 2007 20:46
34 lines
2050 bytes
2050 bytes
Ktoś ostatnio pytał mnie o to ale zgubiłem maila więc tu odpowiadam.
Problem dotyczył: jak od zapytania SELECT FOR XML w Sql Serverze przejść do
xml'a w obiekcie msxml2.domdocument?
var txml=new ActiveXObject('msxml2.domdocument');txml.async=false;
txml.appendChild(txml.createProcessingInstruction('xml','version="1.0"'));
var sConn =
"Provider=SQLOLEDB;Server=mssql\\sqlexpress;Database=xmlguru;Trusted_Connection=yes";
var adoConn = new ActiveXObject("ADODB.Connection");
adoConn.ConnectionString = sConn;
adoConn.CursorLocation = 3;
adoConn.Open();
var adoCmd = new ActiveXObject("ADODB.Command");
adoCmd.ActiveConnection = adoConn;
var sQuery = "<R
xmlns:sql='urn:schemas-microsoft-com:xml-sql'><sql:query>SELECT * FROM Users
WHERE url='xmlguru.net' FOR XML AUTO</sql:query></R>";
var adoStreamQuery = new ActiveXObject("ADODB.Stream");
adoStreamQuery.Open();
adoStreamQuery.WriteText(sQuery,0);
adoStreamQuery.Position = 0;
adoCmd.CommandStream = adoStreamQuery;
adoCmd.Dialect = "{5D531CB2-E6Ed-11D2-B252-00C04F681B71}";
adoCmd.Properties("Output Stream") = txml;
adoCmd.Execute(0,0,1024);
WScript.Echo(txml.xml);
--
td
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads