与ADODB XML输出​​参数在ASP经典 [英] XML output parameters with ADODB in ASP Classic

查看:189
本文介绍了与ADODB XML输出​​参数在ASP经典的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现这个错误寻找一个解决方案在ASP经典检索XML的一个问题:
<一href=\"http://stackoverflow.com/questions/19099334/declaring-xml-output-parameters-with-adodb-in-asp-classic\">Declaring与ADODB XML输出​​参数在ASP经典

I found this error looking for a solution to a problem of retrieving XML at ASP classic: Declaring XML output parameters with ADODB in ASP Classic

我也有同样的错误与传统的ASP工作和SQL Server 2003。我用VB6中的一个.dll,在那里我能得到XML code工作。但现在我需要从SQL做直接到ASP。
你有没有设法解决它?

I have the same error working with Classic ASP and SQL Server 2003. I used to work with a .dll in VB6, where I could get the XML code. But now I need to do it from SQL direct to ASP. Did you manage to solve it?

在传统的ASP我的code到目前为止是:

My code in classic ASP so far is:

set objCommandoOP = Server.CreateObject("ADODB.Command")
Set objCommandoOP.ActiveConnection = objConexion
objCommandoOP.CommandType = adcmdStoredProc
objCommandoOP.CommandText="spProducesXML"
set ParamEnt = objCommandoOP.CreateParameter("@CodOne", adInteger, adParamInput, 4, Entidad())
objCommandoOP.Parameters.Append ParamEnt
set ParamUser = objCommandoOP.CreateParameter("@CodTwo", adInteger, adParamInput, 4, Usuario())
objCommandoOP.Parameters.Append ParamUser
set ParamFrac = objCommandoOP.CreateParameter("@GroupType", adInteger, adParamInput, 4, Request("GrupoFrac"))
objCommandoOP.Parameters.Append ParamFrac
set ParamReturn = objCommandoOP.CreateParameter("@paramReturn", adXML, adParamInputOutput, 4, 0)

objCommandoOP.Parameters.Append ParamReturn

set objResultseto = Server.CreateObject("ADODB.RecordSet")
'Internal procedure that execute the ddbb sp
ExecProcedure objResultseto, adOpenStatic, objCommandoOP

sResult = "<dmo:OperationImport xmlns:dmo='http://www.example.es/XML' xmlns:xs='http://www.w3.org/2001/XMLSchema' />"
sResult = sResult & ParamReturn
sResultXML= sResultXML & "</dmo:OperationImport>"

错误发生在adXML行,因为大卫我无法找到一个XML变量从ddbb带来的参数。我试图把它作为SQL过程的paramReturn(用FOR XML显式的),任何其他的想法?

The error happens at the "adXML" line, since as David I cannot find a XML variable to bring the parameter from the ddbb. I try to take it as paramReturn of the SQL procedure (with FOR XML EXPLICIT), any other ideas?

推荐答案

我终于可以让一个解决方法。基本上是从SQL发送参数作为 VARCHAR(最大)并没有像XML,后治理的ASP为对象Resulset是我将varchar转换为XML。试过了超过30K字符的文件,并仍然有效。
传统的ASP code迄今:

I finally could make with a workaround. basically sending the parameter from SQL as a varchar(max) and not as XML, then treating it in ASP as a Object Resulset were I convert the varchar to an XML. Tried up with files of more than 30k characters and still works. Classic ASP code so far:

`

dim objResultseto
set objResultseto = Server.CreateObject("ADODB.RecordSet")
AbrirProcAlmacenado objResultseto, adOpenStatic, objCommand             

if objResultseto.EOF= false then        
 while (objResultseto.EOF = false)

        Set xmlOperaciones = Server.CreateObject("Msxml2.DOMDocument.4.0")
            xmlOperaciones.Async = False
            xmlOperaciones.loadXML(objResultseto("XML_VAR"))
            xmlOperaciones.setProperty "SelectionNamespaces","xmlns:dmo='http://www.webpage.com/'"
            if xmlOperaciones.parseError = 0 then 
                xmlOperaciones.Save("C:\Example.xml")
                sResultado= "OK"
            end if
            objResultseto.movenext
 wend
else
 response.Write("There are no these kind of operations")
 response.end
end if

请记住,这仅仅是一个解决办法。

Remember that this is just a workaround.

干杯!

这篇关于与ADODB XML输出​​参数在ASP经典的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆