ADO+COM problem 
Author Message
 ADO+COM problem

I use VB5 to write a COM object which will read a access db, and I use a asp
to test it, but got some problem:

vb code:
Private ASPresponse As Response
Private ASPserver As Server
...
Public Sub onstartpage(sc As ScriptingContext)
       Set ASPresponse = sc.Response()
       Set ASPserver = sc.Server()
End Sub
...
Private Sub query2html()
    On Error GoTo Badnews
    attempt = "creating connection"
    Set conntemp = ASPserver.CreateObject("adodb.connection")

    attempt = "opening connection"
    conntemp.Open myconnect

    attempt = "making recordset"
    Set rstemp = conntemp.Execute(myquery)
...
...

test.asp:
<html><head>
<title>dbhelper.asp</title>
<body>
<%
    set mycomponent=server.createobject("project1.class1")
    DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
server.MapPath("test.mdb")
    mycomponent.connect = DSNtemp
    mycomponent.query = "select * from book where book='11' "
    mycomponent.query2html
    set mycomponent=nothing
%>
</body></html>

When I run the above asp, I got
[Microsoft][ODBC Driver Manager] Data source name not found and no default
driver specified
-2147467259

If I use ASP only (no COM), I can run the script without problem, anyone
know what's the problem? Is that using VB5 to write ADO program will have
problem? I've added "ActiveX Data Object Library 2.1" to the Reference in
VB, is it correct?

Regards



Thu, 16 Jan 2003 03:00:00 GMT  
 ADO+COM problem

Can you debug the code to make sure you don't need an additional backslash
before the test.mdb?

Another test is to create an ODBC DSN and test with that to see whether you
have an ADO or ODBC problem.

--
http://www.appfind.com/
the software development exchange


Quote:
> I use VB5 to write a COM object which will read a access db, and I use a
asp
> to test it, but got some problem:

> vb code:
> Private ASPresponse As Response
> Private ASPserver As Server
> ...
> Public Sub onstartpage(sc As ScriptingContext)
>        Set ASPresponse = sc.Response()
>        Set ASPserver = sc.Server()
> End Sub
> ...
> Private Sub query2html()
>     On Error GoTo Badnews
>     attempt = "creating connection"
>     Set conntemp = ASPserver.CreateObject("adodb.connection")

>     attempt = "opening connection"
>     conntemp.Open myconnect

>     attempt = "making recordset"
>     Set rstemp = conntemp.Execute(myquery)
> ...
> ...

> test.asp:
> <html><head>
> <title>dbhelper.asp</title>
> <body>
> <%
>     set mycomponent=server.createobject("project1.class1")
>     DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
> server.MapPath("test.mdb")
>     mycomponent.connect = DSNtemp
>     mycomponent.query = "select * from book where book='11' "
>     mycomponent.query2html
>     set mycomponent=nothing
> %>
> </body></html>

> When I run the above asp, I got
> [Microsoft][ODBC Driver Manager] Data source name not found and no default
> driver specified
> -2147467259

> If I use ASP only (no COM), I can run the script without problem, anyone
> know what's the problem? Is that using VB5 to write ADO program will have
> problem? I've added "ActiveX Data Object Library 2.1" to the Reference in
> VB, is it correct?

> Regards



Sat, 01 Mar 2003 07:10:38 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ADO+COM problem

2. VB6: Problem sharing ADO connection between COM Objects (complex problem)

3. Problem sharing ADO connection between COM Objects (complex problem)

4. VB6: Problem sharing ADO connection between COM Objects (complex problem)

5. Problem sharing ADO connection between COM Objects (complex problem)

6. Problem with ADO in COM-DLL

7. problem with ADO in COM

8. ado/asp/com problem

9. ADO COM DLL Problem

10. ADO COM DLL problem

11. Com 1 and Com 3 sharing IRQ problem

12. COM DLL calling external non-COM DLL problem.

 

 
Powered by phpBB® Forum Software