Calling stored procedures in ASP [message #90976] |
Wed, 23 January 2002 06:13 |
Vinod
Messages: 76 Registered: April 1999
|
Member |
|
|
I have the following procedure and i am trying to call it from ASP. Below is the ASP code.
I am getting the following error.
ADODB.Parameters error '800a0e7c'
Parameter object is improperly defined. Inconsistent or incomplete information was provided.
searchtest.asp, line 13
Please let me know how i can correct that.
<%
Dim objConn
Dim objCmd
'Instantiate objects
Set conn = Server.CreateObject("ADODB.Connection")
Set objConn = Server.CreateObject("ADODB.Connection")
set comm = Server.CreateObject("ADODB.Command")
set param = comm.Parameters
param.append comm.createparameter("strin",adVarChar,1)
param.append comm.createparameter("out",adVarChar,2)
'Note that 3 = adInteger for the datatype
'Note that 1=adParamInput and 2=adParamOutput for parameter direction
'Pass the input value
comm("strin") = "s"
'Execute after setting the parameters
comm.execute
'If your stored procedure returns OUT parameters, here's how to get it
Out_1 = comm("out")
'and so on...
%>
create or replace procedure sear(strin IN VARCHAR,ret OUT VARCHAR)
as
CURSOR datacursor IS SELECT answer FROM new_faq;
datarecord datacursor%ROWTYPE;
out varchar2(10);
BEGIN
OPEN datacursor;
LOOP
FETCH datacursor INTO datarecord;
EXIT WHEN (datacursor%NOTFOUND);
if instr(datarecord.answer, 's') > 0
then
ret := 'out';
DBMS_OUTPUT.put_line('got one!');
end if;
END LOOP;
END;
|
|
|
Re: Calling stored procedures in ASP [message #91296 is a reply to message #90976] |
Wed, 03 July 2002 08:47 |
karin
Messages: 3 Registered: July 2002
|
Junior Member |
|
|
I am trying to call a stored procedure from my asp page and have the return be a stream (or large string) so it can be placed in an xml file and read to an xsl file. Is there a way to return the result as a stream or string instead of a record set.
Thank you
|
|
|
Re: Calling stored procedures in ASP [message #91729 is a reply to message #91296] |
Wed, 22 January 2003 13:24 |
Neal
Messages: 2 Registered: January 2003
|
Junior Member |
|
|
You can try this.....
In the VB Code you can pass your XSL file and use ADODB.Stream to convert the recordset into XML like this:
Dim oxmlOut As New MSXML2.DOMDocument40
oxmlOut = ConvertRSToXML(oReport, "FullAuditReportFullAuditDocumentList1.xsl")
Private Function ConvertRSToXML(ByVal objRS As ADODB.Recordset, _
ByVal strXSLFile As String) As String
Dim objADOStream As ADODB.Stream
Set objADOStream = New ADODB.Stream
Dim oXML As MSXML2.DOMDocument40
Set oXML = New MSXML2.DOMDocument40
Dim oXMLOutput As MSXML2.DOMDocument40
Set oXMLOutput = New MSXML2.DOMDocument40
Dim oXSL As New MSXML2.DOMDocument40
Set oXSL = New MSXML2.DOMDocument40
Dim strXML As String
Dim strXSLFilePath As String
Dim bRet As Boolean
objRS.Save objADOStream, 1 '1=adPersistXML
strXML = objADOStream.ReadText(-1) '-1=adReadAll
oXSL.Load GetXSLPath(strXSLFile)
oXML.async = False
bRet = oXML.loadXML(strXML)
'Debug
If bRet = False Then
Debug.Print "reason: " & oXML.parseError.reason
Debug.Print "srcText: " & oXML.parseError.srcText
Debug.Print "Line: " & oXML.parseError.Line
Debug.Print "linepos: " & oXML.parseError.linepos
Debug.Print "filepos: " & oXML.parseError.filepos
End If
' First Load failed - strip out control characters and try again.
If bRet = False Then
strXML = StripControlChars(strXML)
strXML = Replace(strXML, "&", "&")
bRet = oXML.loadXML(strXML)
End If
oXML.transformNodeToObject oXSL, oXMLOutput
ConvertRSToXML = oXMLOutput.xml
End Function
|
|
|
|
Re: Calling stored procedures in ASP [message #92815 is a reply to message #90976] |
Mon, 07 February 2005 06:32 |
Drew
Messages: 3 Registered: September 2002
|
Junior Member |
|
|
You need to specify the size of the varchar parameter when you append it to the command object. If "strin" is a varchar(255), use the following:
param.append comm.createparameter("strin",adVarChar,1,255)
|
|
|