Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21839

Error when opening connection string

$
0
0
i have a program with MS SQL server 2000 as the database,
when i run my program in my PC it works fine,
but when it's running in CLient PC it always error when opening connection string..
The err msg is "Class doesn't support automation ...."

here's my script

Code:

Public Const UDL_FILE = "ConnStr.udl"

Private Sub Form_Load()
    If Not LoadConnection(App.Path & "\ConnStr.udl") Then
        MsgBox "Please check your connection.", vbCritical, "Load Connection"
        Unload Me
    End If
End Sub

Function LoadConnection(ByVal ConnString As String) As Boolean
On Error GoTo HELL
    'MsgBox "Starting Open Connection " & ConnString
    With oConn
        .CommandTimeout = 60 * 5
        .CursorLocation = adUseClient
        .ConnectionString = "File Name=" & ConnString ' & " ;Password = 'sa'"
        'MsgBox .ConnectionString
        .Open 'this is the problem
        'MsgBox "Open connection success", vbInformation
        LoadConnection = True
    End With
    Exit Function
HELL:
    MsgBox Err.Description & " @GetConnection", vbCritical, "Connection Failed"
    LoadConnection = False
End Function

pls help..

Viewing all articles
Browse latest Browse all 21839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>