Results 1 to 3 of 3

Thread: Data Connection Mystery

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Posts
    8

    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??

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    Yeah - your comp doesn't have the DSN set up so it won't work.

    Get your boss to open the DSN and you write down teh details then make it on your machine it'll probably work then.

    If you can save the dsn as a file and transfer to your machine - easier


    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2002
    Posts
    8

    Thanks, Ecniv

    I do have the DSN on my machine, but discovered late last night that MSSQL Server 2000 wasn't running correctly on the NT 4.0 server.

    Tried to start the server and it flickers then simply stops again. No error message or anything. I'm off to dig into what's going on server side.

    Thanks for your response. Now it's time to play Sherlock. :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width