Results 1 to 5 of 5

Thread: DSN

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163
    You set up the DSN using the ODBC applet in the control panel. When you specify that the DSN is for an Access database it will prompt you for the location of the database. The location could be a mapped drive or a UNC name.

    When you make your connection in your VB app just use the DSN name in the connect string. This is an easy way to move your database and not have to change any code.

    Hope this helps

  2. #2
    New Member
    Join Date
    Mar 2000
    Location
    Rotterdam, Zuid-Holland, Netherlands
    Posts
    12

    You set up the DSN using the ODBC applet in the control panel. When you specify that the DSN is for an Access database it will prompt you for the location of the database. The location could be a mapped drive or a UNC name.
    This part I got.. but the next thing is the problem:
    What code do I put in the source so the project knows that it has to connect to the DSN I made?

    If you could help me on this I'dd be thankfull.

    Sjors

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163
    Here example of where I've used this technique:

    Code:
      ConnectString = "Provider=MSDASQL.1;Persist Security  Info=False;" & _
            "Data Source=ECC_CaseDB;PWD=password"
    
    
        With adoActivity
            .ConnectionString = gsConnect
            .CursorLocation = adUseClient
            .CommandType = adCmdTable
            .RecordSource = "tblkp_ActivityTypes"
            .Refresh
        End With
    This example use an ADO data control, however you can use the same connection with any ado connection.

  4. #4
    New Member
    Join Date
    Mar 2000
    Location
    Rotterdam, Zuid-Holland, Netherlands
    Posts
    12

    Question

    Uhm.. one question

    This code I have to put it in the Form or on top of the project?

    Sounds maybe stupide, but I'm not so long on to this VB thing, so.

    But thanks anywhay for the information guys.


  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163
    If your making multiple connections to the same database then you might want to define a form level variable to hold the connect string and then set it in your form load procedure.

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