Error while getting Recordset from component in ASP

S

Sudhakar Sankar

Hi all,

I am using a COM+ component to fetch the Recordset from the database.
My coding is as follows:

' ------ In COM+ Application --------------
Function executeResultQuery(Con as Connection, qry as String) As
Object
dim oRs as New ADODB.Recordset
oRs.open qry, con
Set executeResultQuery = oRs
End Function

'------- In ASP Page

<%
Set obj=Server.CreateObject("myProj.MyClass")
Set con=Server.CreateObject("ADODB.Connection")
con.open "mydsn","",""
sql = "select * from students"
Set rs = obj.executeResultQuery(con,sql) <--- Error raised here
While not rs.eof
response.write(rs(0))
rs.movenext
Wend
%>

At the time of processing the ASP page, i am getting the following
error:

Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'executeResultQuery'
/remote/sample1.asp, line 16

What is the problem here?

I changed in COM+ application as "Recordset" from "Object" for the
return type. No luck.

Advise appreciated.

Thanks & regards,

S.Sudhakar Sankar.
 
B

Bob Barrows

Sudhakar said:
Hi all,

I am using a COM+ component to fetch the Recordset from the database.
My coding is as follows:

' ------ In COM+ Application --------------
Function executeResultQuery(Con as Connection, qry as String) As
Object
dim oRs as New ADODB.Recordset
oRs.open qry, con
Set executeResultQuery = oRs
End Function

'------- In ASP Page

<%
Set obj=Server.CreateObject("myProj.MyClass")
Set con=Server.CreateObject("ADODB.Connection")
con.open "mydsn","",""
sql = "select * from students"
Set rs = obj.executeResultQuery(con,sql) <--- Error raised here
While not rs.eof
response.write(rs(0))
rs.movenext
Wend
%>

At the time of processing the ASP page, i am getting the following
error:

Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'executeResultQuery'
/remote/sample1.asp, line 16

What is the problem here?

I changed in COM+ application as "Recordset" from "Object" for the
return type. No luck.

Advise appreciated.

Thanks & regards,

S.Sudhakar Sankar.

http://support.microsoft.com?kbid=197956
http://support.microsoft.com?kbid=243548
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OGR8dX8J$GA.150@cppssbbsa04
http://tinyurl.com/t4zi

HTH,
Bob Barrows
 
M

Mark Schupp

Try:

Function executeResultQuery(ByRef Con, ByVal qry)
Set executeResultQuery = Con.Execute(qry)
End Function

Or better, just put the con.execute statement inline in the asp script.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top