Click here to Skip to main content
15,883,731 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have connected like this
C#
OleDbConnection connection = new OleDbConnection();
        connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\mohamed.rifkan\Documents\Database2.accdb;
Persist Security Info=False;";
Posted
Updated 20-Nov-14 16:50pm
v2

1 solution

Don't use hardcoded path for the database. you can use relative path or DataDirectory as described in This answer[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900