Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disconnected RecordSet from dll?

Status
Not open for further replies.

RichS

Programmer
Apr 24, 2000
380
US
Hey all,
there are many posts that reference recordsets but I have found none that answer this problem.

I have a dll function typed as an ADODB.Recordset that returns a disconnected recordset. this works fine in VB but I have been unsuccessful getting it to work in ASP.

The ASP code is:

<%
dim rs
dim oPS

set rs = server.CreateObject(&quot;ADODB.Recordset&quot;)
set oPS = server.CreateObject(&quot;MyDll.Main&quot;)

rs = oPS.NullPayees_Get

do until rs.EOF
Response.Write rs(&quot;HeaderID&quot;) & &quot;<BR>&quot;
rs.MoveNext
loop

set rs = nothing
set oPPS = nothing
%>
I get the error (amoung others...)
&quot;Object doesn't support this property or method: 'EOF'&quot;
even though the EOF shows up in the Intellisense drop down.

Also the .NullPayees_Get function shows up in the Intellisense drop down in Visual Interdev.

Using Visual Interdev SP5.

Any ideas?

Rich



 
It's a long shot.. but try switching the loop to:

I seem to remember reading somewhere that sometimes ADO has issues with the Do/Loop..


While NOT rs.EOF
Response.Write rs(&quot;HeaderID&quot;) & &quot;<BR>&quot;
rs.MoveNext
Wend

and if it doesn't work.. no harm done. =)

These threads also might be of use:


The PogoWolf
 
Thanks PogoWolf,
Got similar results with the While/Wend statement. Also found an additional link at:


which gives a kindergarten perspective of exactly what i am trying to do. I am doing it just as all the references say to do it but still without success. This is too weird.

Still the suggestion is appreciated.

Rich
 
You need to set the rs = oPS.NullPayees_Get
as shown below


<%
dim rs
dim oPS

set rs = server.CreateObject(&quot;ADODB.Recordset&quot;)
set oPS = server.CreateObject(&quot;MyDll.Main&quot;)


'************
' ADD SET BELOW
set rs = oPS.NullPayees_Get


do until rs.EOF
Response.Write rs(&quot;HeaderID&quot;) & &quot;<BR>&quot;
rs.MoveNext
loop

set rs = nothing
set oPPS = nothing
%>
 
Thanks SarkMan. I now get the error:

ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.

I have tried .Open, .SetRecordset and other methods also. I am starting to wonder if this is a Microsoft bug.
 
Is anything in the recordset that is returned from the dll?

Where are you getting the error now?

post the code for the dll.
 
Whew!! Got it. I was defining the connection in a class module in the dll. When I moved the connection to the dll function that was being called from the ASP page it worked. I still don't know why VB had no problem with it being done this way and ASP did. Maybe it has something to do with ASP being scripted rather than compiled.

Thanks,
Rich
 
Has anyone had this experience before?: If my dll has any private classes, and if i want to return a recordset all i will get is a zero lenght string in ASP ( in VB I get the recordset). Does anyone know why this is?
 
Have you added Microsoft ActiveX Data Object Library to your Interdev Project?

I am doing appx the same thing but in my global.asa there is an entry as follows:

<!--METADATA TYPE=&quot;TypeLib&quot; NAME=&quot;Microsoft ActiveX Data Objects Recordset 2.5 Library&quot; UUID=&quot;{00000300-0000-0010-8000-00AA006D2EA4}&quot; VERSION=&quot;2.5&quot;-->

Try this ...
 
Thanks for the reply.

I am using the 2.7 library.

<!--METADATA TYPE=&quot;TypeLib&quot; NAME=&quot;Microsoft ActiveX Data Objects Recordset 2.7 Library&quot; UUID=&quot;{00000300-0000-0010-8000-00AA006D2EA4}&quot; VERSION=&quot;2.7&quot;-->
Also switched to 2.5 - same results.

Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top