Hello everyone. I'm newbie here in the forum. This is my first thread.
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. Thank you very much.
below is my hard coded connection string which is working file.
Dim conn As New System.Data.OleDb.OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\JV\Desktop\MyVBProject\FeedBackSystem\KPI.accdb"
Then I change to this code and I'm getting error. It say "Could not find the file. C:\Users\JV\Desktop\MyVBProject\FeedBackSystem\bin\x86\Debug\KPI.accdb"
Dim conn As New System.Data.OleDb.OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source= |DataDirectory|\KPI.accdb"
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. Thank you very much.
below is my hard coded connection string which is working file.
Dim conn As New System.Data.OleDb.OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\JV\Desktop\MyVBProject\FeedBackSystem\KPI.accdb"
Then I change to this code and I'm getting error. It say "Could not find the file. C:\Users\JV\Desktop\MyVBProject\FeedBackSystem\bin\x86\Debug\KPI.accdb"
Dim conn As New System.Data.OleDb.OleDbConnection()
conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source= |DataDirectory|\KPI.accdb"