I am using the following codes to connect to MS Access database using vb.net code. I am providing the file path name and directory. This codes work fine in my computer. How can I make this codes as dynamics connection that can run to another computer that no need to change the path. I'm using MS Access 2013 and Visual Studio 2008 (VB.NET). Below is the connection string code i used to connect to database in VB.NET form. So, how and what is the connection string I will be going to use in my form. This is bothering me. I am testing my application and the database is stored and access in bin/Debug folder, why it is the below path was not access instead. thanks.
--This is a hard coded connection string conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\JV\Desktop\MyVBProject\FeedBackSystem" --Then I change to this one. Dim conn As New System.Data.OleDb.OleDbConnection() conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source= |DataDirectory|\KPI.accdb" I'm getting an error. could not find the file. C:\Users\JV\Desktop\MyVBProject\FeedBackSystem\bin\x86\debug\KPI.accdb.