Hello everyone

I've just received my SAP DB CDRom, installed it on a Win2K box, and
everything is fine.
I've looked at (and run) the VB source to SQL Studio, and can connect and do
queries and everything,
but when I add a reference to the SQLStudioDBLayer.dll in my own project, I
simply can't connect.
I have installed the ODBC driver, everything is in the right places (DLL's
registered etc) but it just won't connect.

Here's a snippet from the Connections.cls class module in the
SQLStudioDBLayer project.

' responsible:  WolfgangA
'
' special area: SQL Studio DB Layer
'
' description:  class for handling a connection pool
'
'
'
'  How to receive a database connection from the connections object ?
'
'  1. create a instance of saodbconnections
'     set oconman = new sapdbxconnections
'
'  2. create a con object
'     set ocon = sapdbcon
'
'  3. set all available connect params
'     oconman.uid = "user"
'     oconman.pwd = "pwd"
'     oconman.driver = "SAP DB DRIVER"
'
'  4. set poolingmode
'
'  5. call oconman.getconnection(autoCommit,....,ocon)
'
'     the first call of getconnection will always Get the attributes of the
driver
'     execption: sql mode oracle is set, e.g. for support mode with not
exclusive user
'
'  6. check returncode and if valid error object of ocon object
'
'  6. call conman.disconnect to close all open database connections

I've tried to follow this, but I'm having some trouble.

I've got:

References: DSQLControl, SQLStudioDBLayer

In the declarations section of a VB form:

Dim oConMan As Connections
Dim oCon As connection

In the Form_Load event

    Set oConMan = New Connections
    set oCon = New connection

I get an error on this line at compile time - "Invalid use of New keyword"
my copy of SQLStudioDBLayer has connection.cls as public not creatable
shouldn't it be multi-use?

    oConMan.dataBase = "TST"
    oConMan.dbServer = "win2k"
    oConMan.hWnd = Me.hWnd
    oConMan.pwd = "dba"
    oConMan.uid = "dba"
    oConMan.driver = "SAP DB DRIVER"
    oConMan.driverIsoLevel = Committed
    oConMan.driverSQLMode = Internal
    oConMan.poolingMode = WA_DBC_SHARED

    If oConMan.getConnection(Committed, Internal, AutoCommitOn, oCon) Then
        MsgBox "connected"
    Else
        MsgBox "not connected - " & oCon.Error.Text
    End If

when I remove the Set oCon = new connection, it runs ok, but then I get the
"not connected" messagebox and an error frm the oCon object of "Cancel
Pressed"    !!!!!

Can some nice someone please tell me what I'm doing wrong?


Thanks very much


Brad

_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to