owinterton Posted March 18, 2003 Posted March 18, 2003 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? Quote
silverstormboy Posted March 20, 2003 Posted March 20, 2003 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() Quote
owinterton Posted April 9, 2003 Author Posted April 9, 2003 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.