I have a COM .exe running in a server. The database is SQLServer.
The component is running fine if used from VB.
This class requires a connection before it can use any of its methods (see line 5)
I know that the ado connection is working fine because I can get a recordset if using a query, but when calling the method that returns a recordset I get this:
Error message:
Microsoft VBScript runtime error '800a01a8'
Object required
/demos/list.asp, line 8
1.set adocnn = server.CreateObject ("adodb.connection"
2.adocnn.Open "database","user","pwd"
3.
4.Set objtest = server.Createobject("MyObject.MyClass"
5.set objtest.adoCnn = adocnn
6.set rst = objtest.Getlist()
7.
8.If (rst.BOF and rst.EOF) Then
9. Response.Write "Error in data"
10.else
11. Response.Write "<table border=1>"
12. Do While Not rst.EOF
13. Response.Write "<tr>"
14. Response.Write "<td>" & rst("UserNum"
& "</td>"
15. rst.MoveNext
16. Loop
17. Response.Write "</table>"
18.End If
19.rst.Close
20.Set objtest = Nothing
21.Set rst = Nothing
The method is like:
Public Function GetList() As ADODB.Recordset
Dim sql$
Dim hRs As ADODB.Recordset
Dim bRet As Boolean, vException As Variant
sql$ = "select * from lists order by 1"
bRet = GetDBData(sql$, hRs, vException) '--- this makes the query and returns another recordset.
If bRet Then
Set GetRouteList = hRs
End If
End Function
Any ideas? Please help me with this, I've been struggling with this for two days now.
The component is running fine if used from VB.
This class requires a connection before it can use any of its methods (see line 5)
I know that the ado connection is working fine because I can get a recordset if using a query, but when calling the method that returns a recordset I get this:
Error message:
Microsoft VBScript runtime error '800a01a8'
Object required
/demos/list.asp, line 8
1.set adocnn = server.CreateObject ("adodb.connection"
2.adocnn.Open "database","user","pwd"
3.
4.Set objtest = server.Createobject("MyObject.MyClass"
5.set objtest.adoCnn = adocnn
6.set rst = objtest.Getlist()
7.
8.If (rst.BOF and rst.EOF) Then
9. Response.Write "Error in data"
10.else
11. Response.Write "<table border=1>"
12. Do While Not rst.EOF
13. Response.Write "<tr>"
14. Response.Write "<td>" & rst("UserNum"
15. rst.MoveNext
16. Loop
17. Response.Write "</table>"
18.End If
19.rst.Close
20.Set objtest = Nothing
21.Set rst = Nothing
The method is like:
Public Function GetList() As ADODB.Recordset
Dim sql$
Dim hRs As ADODB.Recordset
Dim bRet As Boolean, vException As Variant
sql$ = "select * from lists order by 1"
bRet = GetDBData(sql$, hRs, vException) '--- this makes the query and returns another recordset.
If bRet Then
Set GetRouteList = hRs
End If
End Function
Any ideas? Please help me with this, I've been struggling with this for two days now.