Calling Stored Procedure from DLL function

Results 1 to 4 of 4

Thread: Calling Stored Procedure from DLL function

  1. #1
    Ryan L Guest

    Default Calling Stored Procedure from DLL function

    I am having problems returning a recordset from a DLL function that I created. I have a DLL function that executes a stored procedure. The DLL function is then supposed to pass back a recordset (Oracle Table) to the ASP page. The stored proc runs when I call it from the ASP page, but when I try to reference the recordset that is passed back I get the following error:<BR><BR>ADODB.Recordset error &#039;800a0e78&#039; <BR><BR>Operation is not allowed when the object is closed. <BR><BR>Why is it saying that operation is closed?<BR><BR>--------------------<BR>ASP Code<BR>--------------------<BR>&#060;%@ LANGUAGE="VBSCRIPT" %&#062;<BR>&#060;% Option Explicit %&#062;<BR>&#060;%<BR>Dim obj<BR>Dim oResults<BR><BR>set obj = Server.CreateObject("prjFuncSP2.clsFuncSP2")<BR><B R>set oResults = obj.f_std_proc(6115)<BR><BR>Do while not oResults.EOF<BR> response.write("first name: " & oResults(0))<BR> response.write("last_name name: " & oResults(1))<BR> oResults.MoveNext<BR>Loop<BR><BR>set oResults = nothing<BR>set obj = nothing<BR>%&#062;<BR><BR>--------------------<BR>VB Code in DLL<BR>--------------------<BR>Public Function f_std_proc(ByVal iOrderId As Integer) As ADODB.Recordset<BR> Dim Conn As ADODB.Connection<BR> Dim oCmd As ADODB.Command<BR> Dim rs As ADODB.Recordset<BR> Dim sSQL As String<BR> Dim sTemp As String<BR> <BR> Set Conn = CreateObject("ADODB.Connection")<BR> Conn.Provider = "MSDAORA"<BR> Conn.Open "myDB", "myUserName", "myPassword"<BR> <BR> sSQL = "{call ora_package.ora_procedure(?,{resultset 100, as_customer_last_name, as_customer_first_name})}"<BR> <BR> Set oCmd = New ADODB.Command<BR> With oCmd<BR> Set .ActiveConnection = Conn<BR> .CommandText = sSQL<BR> .CommandType = 1<BR> .Parameters(0).Direction = 1<BR> .Parameters(0).Value = iOrderId<BR> End With<BR> Set rs = oCmd.Execute()<BR> Set f_std_proc = rs<BR> <BR> Conn.Close<BR> Set oCmd = Nothing<BR> Set rs = Nothing<BR><BR>End Function<BR><BR>------------------------------<BR><BR>The DLL function works fine, in the stored procedure I have a function that writes to a table at the end of the procedure so that I know that the Stored Procedure was run. It&#039;s just when I try to use the record set that is supposed to be passed back I get an error on the line of my ASP code that says:<BR> if not oResults.EOF then<BR>Any help would be greatly appreciated.<BR><BR>Ryan

  2. #2
    Andy McCormack Guest

    Default RE: Calling Stored Procedure from DLL function

    Try looking up use of disconnected recordsets. In the VB you need to specify the recordset as a clientside recordset, retrieve the recordset then set the active connection to nothing.<BR>Do not close the recordset as you are going to need it in the ASP<BR><BR>Cheers

  3. #3
    Kelso Guest

    Default RE: Calling Stored Procedure from DLL function

    I fixed this by declaring the return value of the function as object rather than ADODB.Recordset<BR><BR>I hope it works for you too<BR><BR>Kelso

  4. #4
    Join Date
    Dec 1969

    Default RE: Calling Stored Procedure from DLL function

    ýf you wanna I can sell you a very affactive connection dll<BR>directly called from asp and anothor connection object called<BR>from another dll with open source written in VB6.0 and full<BR>asp&inc function documantation and error control functions also.<BR><BR>You can write<BR><BR>Goodworks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts