|
-
Aug 7th, 2002, 03:46 PM
#1
Thread Starter
New Member
Data Connection Mystery
Hi,
I'm trying to connect to a MSSQL 7.0 database using a class that creates the connection. I can't from my machine, yet my boss can from his. He tells me that this was working a week ago and as far as he knows nothing has changed. (I've just started on this project).
Here are the details:
The connection call comes from a function called InitializeOpenSubs which contains the following two lines:
Set OpenSubs = CreateObject("prjopensubs.clsopensubs")
InitializeOpenSubs = OpenSubs.OpenConnection(DatabaseName, DatabaseType)
This creates the clsopensubs class and calles the OpenConnection function. The OpenConnection function contains the following:
On Error GoTo OpenConnectionError
Set m_cn = Nothing
Set m_cn = New ADODB.Connection
m_cn.CursorLocation = adUseServer
m_cn.CommandTimeout = 120 '60
m_cn.ConnectionTimeout = 120 '60
m_strDatabaseName = DatabaseName
m_enuDatabaseType = DatabaseType
If m_enuDatabaseType = enuDatabaseType.sql Then
m_cn.Provider = "MSDASQL" ' SQL 6.5 provider
m_cn.ConnectionString = "DSN=LAS;UID=LAS;PWD=microc"
m_cn.Open
m_cn.DefaultDatabase = m_strDatabaseName
Else
m_cn.Provider = "Microsoft.Jet.OLEDB.4.0"
m_cn.ConnectionString = App.Path & "\" & m_strDatabaseName & ".mdb"
m_cn.Open
End If
On Error GoTo 0
OpenConnection = True
Exit Function
OpenConnectionError:
If m_enuDatabaseType = enuDatabaseType.sql Then
MsgBox "DSN 'LAS' is not available right now"
Else
MsgBox "Unable to locate " & App.Path & "\" & m_strDatabaseName & ".mdb"
End If
Set m_cn = Nothing
OpenConnection = False
When I attempt to run the program, I get the DSN 'LAS' is not available right now. Msgbox. My boss doesn't.
I checked the references and the system is using the Microsoft ActiveX Data Objects 2.5 Library, and I have tested the DSN and the test says I can connect successfuly.
Any ideas??
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|