A
Angel
Anyone know why this asp page below produces a value of 0
for the length of --> Len(objStream.ReadText). I've been
trying to get data from the stored procedure sp_GetAutoXML
into the stream to no avail. When we run the stored
procedure in query analyzer, it does return data.
Thanks............Angel
<%
dim objStream
dim objConn
dim objComm
dim objXML
set objStream = Server.CreateObject("ADODB.Stream")
set objConn = Server.CreateObject("ADODB.Connection")
set objComm = Server.CreateObject("ADODB.Command")
set objXML = Server.CreateObject("MSXML2.DOMDocument")
dim strXMLOutput
dim varStart
dim varEnd
Const ReadBytes = 131072
'Response.Write "ASP - Hello1 "
objConn.Open "Provider=SQLOLEDB; Data Source=dpc-sql2;
database=ProjectServer0001;
UId=xxx; Pwd=yyy"
If objConn.errors.count > 0 Then
Response.Write "NOT Connected"
End If
objComm.ActiveConnection = objConn
objComm.CommandType = adCmdStoredProc
objComm.CommandText = "sp_GetAutoXML"
objStream.Open
'objComm.Properties("Output Stream").Value = objStream
response
objComm.Properties("Output Stream") = response
objComm.Properties("XML Root").Value = "data"
objComm.Execute , , adExecuteStream
If objstream is nothing then
Response.Write "objStream is NOTHING"
end if
If IsEmpty(objStream.ReadText) Then
Response.Write "objStream.ReadText is EMPTY"
End If
objConn.Close
objStream.Position = 0
varStart = Now
With objStream
Do While Not .EOS
strXMLOutput = strXMLOutput & .ReadText(ReadBytes)
Loop
End With
varEnd = Now
objXML.LoadXML("<?xml version='1.0'?><?xml-stylesheet
type='text/xsl'
href='pmois.xsl'?><Project_List>" & varStart & "/-- " & Len
(strXMLOutput) & " --/-- "
& Len(objStream.ReadText) & " --/ " &varEnd
& "</Project_List>")
if objXML.parseError.errorCode <> 0 then
Response.Write "Error loading XML: " &
objXML.parseError.reason
Response.End
end if
Response.ContentType = "text/xml"
Response.Write objXML.xml
Set objStream = Nothing
Set objComm = Nothing
Set objConn = Nothing
%>
for the length of --> Len(objStream.ReadText). I've been
trying to get data from the stored procedure sp_GetAutoXML
into the stream to no avail. When we run the stored
procedure in query analyzer, it does return data.
Thanks............Angel
<%
dim objStream
dim objConn
dim objComm
dim objXML
set objStream = Server.CreateObject("ADODB.Stream")
set objConn = Server.CreateObject("ADODB.Connection")
set objComm = Server.CreateObject("ADODB.Command")
set objXML = Server.CreateObject("MSXML2.DOMDocument")
dim strXMLOutput
dim varStart
dim varEnd
Const ReadBytes = 131072
'Response.Write "ASP - Hello1 "
objConn.Open "Provider=SQLOLEDB; Data Source=dpc-sql2;
database=ProjectServer0001;
UId=xxx; Pwd=yyy"
If objConn.errors.count > 0 Then
Response.Write "NOT Connected"
End If
objComm.ActiveConnection = objConn
objComm.CommandType = adCmdStoredProc
objComm.CommandText = "sp_GetAutoXML"
objStream.Open
'objComm.Properties("Output Stream").Value = objStream
response
objComm.Properties("Output Stream") = response
objComm.Properties("XML Root").Value = "data"
objComm.Execute , , adExecuteStream
If objstream is nothing then
Response.Write "objStream is NOTHING"
end if
If IsEmpty(objStream.ReadText) Then
Response.Write "objStream.ReadText is EMPTY"
End If
objConn.Close
objStream.Position = 0
varStart = Now
With objStream
Do While Not .EOS
strXMLOutput = strXMLOutput & .ReadText(ReadBytes)
Loop
End With
varEnd = Now
objXML.LoadXML("<?xml version='1.0'?><?xml-stylesheet
type='text/xsl'
href='pmois.xsl'?><Project_List>" & varStart & "/-- " & Len
(strXMLOutput) & " --/-- "
& Len(objStream.ReadText) & " --/ " &varEnd
& "</Project_List>")
if objXML.parseError.errorCode <> 0 then
Response.Write "Error loading XML: " &
objXML.parseError.reason
Response.End
end if
Response.ContentType = "text/xml"
Response.Write objXML.xml
Set objStream = Nothing
Set objComm = Nothing
Set objConn = Nothing
%>