How do I use a VB6 dll to connect to a db from an asp page 
Author Message
 How do I use a VB6 dll to connect to a db from an asp page

I want to create a component in VB6 to establish a db connection to SQL
Server.  I want to be able to use it from an asp page but I can't get a
handle on how it's done.

So far my VB program has a class called DBConn with this code......
Option Explicit
Private m_strDBString As String
Private m_db As ADODB.Connection

Public Sub Configure(ByVal strDBString As String)
If strDBString = "test1" Then
    m_strDBString = "Provider=SQLOLEDB;Server=Test1;Initial
Catalog=Test2;User ID=test;Password=test;"
Else
    m_strDBString = "Provider=SQLOLEDB;Server=Test2;Initial
Catalog=Test2;User ID=test;Password=test;"
End If
End Sub

Public Property Get DB() As Connection
    If m_db Is Nothing Then
        Set m_db = New Connection
        m_db.Open m_strDBString
    End If
    Set DB = m_db
End Property

My asp page has this.......
dim objConn
dim objCmd
objConn=Server.CreateObject("DBConn.DBConn")
objConn.Configure("test1")
Set objCmd=Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection=objConn

I'm not sure what to do after this.  It blows up on the last line with the
error "Arguments are of the wrong type, are out of acceptable range, or are
in conflict with one another".   I think it's because I'm not calling the
Get DB() property.  How do I get the connection back?

Thanks



Sun, 04 Sep 2005 07:00:35 GMT  
 How do I use a VB6 dll to connect to a db from an asp page
Just by looking at it...

did you try to instead of:
dim objConn
dim objCmd

change to:
dim objConn as adodb.connection
dim objCmd adodb.command

and instead of:
Public Property Get DB() As Connection

change to:
Public Property Get DB() As adodb.Connection

Maybe you also could try to change the Configure sub to a function and
return the connection = move the Get property code into the new
configure FUNCTION.

Did you register the DLL on the server?

I didn't test it, this was just by looking at the code and reading the
error message. Let me/us know how it goes.

-Mathias->

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 05 Sep 2005 00:56:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Connect to Oracle using OLE DB in ASP

2. Debug Problem connecting between ASP pages on website and VB DLL

3. Connecting to remote SQL server via Internet using ASP page and Comm object

4. Newbie: Connecting to an Informix DB using VB6

5. using a DLL to connect to a SQL db

6. Debugging VB6 dll for ASP page

7. *** Using ActiveX DLL on an ASP page ***

8. COM DLL used in ASP page won't release

9. Using VB to connect to DB without using ODBC

10. Using VB to connect to DB without using ODBC

11. Using VB to connect to DB without using ODBC

12. export data from one access db to same db on another machine using vb6

 

 
Powered by phpBB® Forum Software