Accessing XML Stream from ADO to SQL Server 2008

We are porting the ASP code that ADO used to connect to SQL Server 2000. For the most part, the code was ported without glitch to SQL Server 2008 after the connection was defined, but one type of query throws up an error that puzzles me.

Against SQL 2000 we will use code like this:

set oCommand = Server.CreateObject("ADODB.Command")
oCommand.ActiveConnection = oConn 'already established
oCommand.CommandType = adCmdText 

'This is simplified over the real code, but the wrapper is what we use.
oCommand.CommandText = "<Root xmlns:sql='urn:schemas-microsoft-com:xml-sql'><sql:query>" 
+ Server.HTMLEncode(sql) 
+ "</sql:query></Root>" 

oCommand.Dialect = "{5D531CB2-E6ED-11D2-B252-00C04F681B71}" 'SQL Dialect GUID
oCommand.Properties("Output Stream").Value = oXMLDoc 'Already created
oCommand.Execute , , adExecuteStream 'The point of error

      

SQL is a stored procedure call that works fine when called. This code continues to work against SQL 2000, but as of SQL 2008 it returns:

ERD_OPENSQLXML XMLDB.openSQLXML error. Error "-2147217898": "Command dialect is not supported by this provider".

My first guess is that SQL 2008 relies on MSXML 6 and I need a new guid. My MSDN and Google-Fu didn't work for me: all the results I find are using this GUID.

Is there a new GUID? Is there a better way? Is it better to do this than recode in ASP.NET (the fate of many pages is already).

EDIT: I'm wondering if using the SQLNCLI10 client makes it work?

configConnString = 
"Provider=SQLNCLI10;DataTypeCompatibility=80;Server=XYZZY;Database=ucpm;MARS Connection=True;Trusted_Connection=Yes;"

      

+1


a source to share


1 answer


Instead of focusing on a language I haven't seen yet, registered as modified - ASP.dll is still supported on the next version of Windows Server from the last check I did.



You can check that the client you are connecting with has a native MSSQL 10 client and not the old odbc / oledb sql 2000 clients.

+1


a source







All Articles