Link to home
Start Free TrialLog in
Avatar of rajani50
rajani50

asked on

common method for database connection?

I wrote the following code in my MDIForm load method.....This is my first loading form name.So i wrote
the common coneection here.
But when i run this application ..i got compilation error
like "Invalid attribute in sub or function"..
Can u help me from this please...
rgds,
rajani
Public Sub MDIForm_Load()
    Dim sConnect As String
    Public dfwConn As ADODB.Connection
    Dim cmd As ADODB.Command
     'set strings
        sConnect = "Provider=MSDASQL.1;Connect Timeout=15;Extended Properties='DSN=ACR;DBQ=c:\windows\desktop\ACRData.mdb;DriverId=281;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;';Locale Identifier=3081"
        ' open connection
        Set dfwConn = New Connection
        dfwConn.Open sConnect
        Set cmd = New Command
        cmd.ActiveConnection = dfwConn
        cmd.CommandType = adCmdStoredProc
     
End Sub
ASKER CERTIFIED SOLUTION
Avatar of dtomyn
dtomyn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rajani50
rajani50

ASKER

thanks for ur reply