Link to home
Start Free TrialLog in
Avatar of makman111
makman111

asked on

Errors Streaming XML with ADO 2.7 (500 pts)

I keep getting the following error when I am using XML and ADO Streaming (2.7)  Any sugestions?

ADODB.Command error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/test4.asp, line 19


My code looks like

     Dim oStream, oCmd
     Set oStream = Server.CreateObject("ADODB.Stream")
     Set oCmd = Server.CreateObject("ADODB.Command")
     Set objDB = Server.CreateObject("ADODB.Connection")
     
     objDB.Open Session("MyDSN")

     szProc = "get_HostHistory_XML  1, 1, 'ATL01SSA21FSA01'"
     'objRS.Open "exec get_HostHistory_XML  1, 1, 'ATL01SSA21FSA01'", objDB
     'SqlStmt = "SELECT * FROM HostHistory WHERE NodeName='ATL01SSA21FSA01' FOR XML AUTO"
         
     oStream.CharSet = "windows-1252"
     ' function which returns ADODB.Connection Object that is
     ' opened successfully
     oStream.Open
     Set oCmd.ActiveConnection = objDB
     oCmd.CommandText = "get_HostHistory_XML  1, 1, 'ATL01SSA21FSA01'"
     oCmd.Properties("Output Stream").Value = oStream
     oCmd.Properties("XML Root") = "root"
     oCmd.Properties("Output Encoding") = "iso-8859-1"
     oCmd.Execute , , 1024
     oCmd.ActiveConnection.Close
     oStream.Position = 0

     GetData = oStream.ReadText()
     oStream.Close
     
     Response.Expires = -1500
     Response.CacheControl = "no-cache"
     Response.ContentType = "text/xml"

     Response.Write(GetData)
         
     objDB.Close
     Set oCmd = Nothing
     Set oStream = Nothing
Avatar of gladxml
gladxml

makman111,

Tyr ot check this link might help...

http://www.adopenstatic.com/faq/800a0cc1.asp
Avatar of makman111

ASKER

Nope - not it.  I modifyied the code and now I am getting the following

Microsoft XML Extensions to SQL Server error '80040e14'

MSXML3: Invalid at the top level of the document.

/test4.asp, line 22


I changed the connection string to

objDB.Open "provider=SQLOLEDB;uid=sa;pwd=;database=mssportal;"
Figured it out...

Code reads

<%
     Dim oStream, oCmd
     Set oStream = Server.CreateObject("ADODB.Stream")
     Set oCmd = Server.CreateObject("ADODB.Command")
     Set objDB = Server.CreateObject("ADODB.Connection")
     
     objDB.Open "provider=SQLOLEDB;uid=sa;pwd=;database=mssportal;"
     szProc = "get_HostHistory_XML  1, 1, 'ATL01SSA21FSA01'"
     'objRS.Open "exec get_HostHistory_XML  1, 1, 'ATL01SSA21FSA01'", objDB
     'SqlStmt = "SELECT * FROM HostHistory WHERE NodeName='ATL01SSA21FSA01' FOR XML AUTO"
         
     oStream.CharSet = "windows-1252"
     ' function which returns ADODB.Connection Object that is
     ' opened successfully
     oStream.Open
     Set oCmd.ActiveConnection = objDB
     oCmd.CommandText = "get_HostHistory_XML  1, 1, 'ATL01SSA21FSA01'"
     oCmd.Properties("XML Root") = "root"
     oCmd.Properties("Output Encoding") = "iso-8859-1"
     oCmd.Properties("Output Stream") = oStream
     oCmd.Execute , , 1024
     oStream.Position = 0

     GetData = oStream.ReadText()
     oStream.Close
     
     Response.Expires = -1500
     Response.CacheControl = "no-cache"
     Response.ContentType = "text/xml"

     Response.Write(GetData)
         
     objDB.Close
     Set oCmd = Nothing
     Set oStream = Nothing

%>
ASKER CERTIFIED SOLUTION
Avatar of gladxml
gladxml

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial