Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I am trying to develop my windows application and make the connection to the database as flexible as possible so that when I deploy it, the app will work on anyone's computer and the user can identify the path where the database will live. I am new to VB.net so I have no clue as to how to set the connection string so that it will know where the path is at all times. I'm working with VB.net for Windows apps and an Access database. I am trying to migrate the access database to an Windows 2000 SQL Server eventually. Any ideas out there to help solve my dilemma?
Posted

put your database into the ...\...\Bin\ directory,

then:

Dim strPath As String = Application.StartupPath()

ex:

Import System.Data.OleDb

Dim strConnection As String = _
   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath & "\Northwind.mdb"
Dim cn As OleDbConnection = New OleDbConnection(strConnection)
cn.Open()

That should open the connection.

to close it:

cn.close()

  • 3 weeks later...
Posted
Thanks SilverStormBoy. You have solved much of my frustration. I tried to set the connection string but I couldn't figure out how to make it work the way I wanted it. Thanks a bunch.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...