Click here to Skip to main content
15,887,325 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The current problem I'm having is an error message that it could not find file C: now I dont know what the problem is because the file is in that location. I have I tried in both .accbd and .mbd.
C#
 private static OleDbConnection GetConnection()
{
    OleDbConnection conn = new OleDbConnection();
    String connectionString = @"Provider=Microsoft.JET.OlEDB.4.0;"
                              + @"Data Source= C:\Temp\F1\Docs\ExpeditorsProject\Table1.accbd";
    conn = new OleDbConnection(connectionString);
    conn.Open();
    return conn;
}
Posted
Updated 4-Jan-16 20:29pm
v3
Comments
BillWoodruff 5-Jan-16 2:48am    
if(! File.Exists(@"C:\Temp\F1\Docs\ExpeditorsProject\Table1.accbd") throw new FileNotFoundException("file not there");

add to your code at the start of the method, and test
Richard MacCutchan 5-Jan-16 3:59am    
What is the exact full text of the error message?

Make sure database exist in the location.
Additionally, for more help on connection strings, try Access connection strings - ConnectionStrings.com[^].
 
Share this answer
 
Error clear shows the file is not exist on said path. Please check for the specified path and see if it really exist.
 
Share this answer
 
Got the answer it had nothing to do with the location because as I have stated that the file is located there
C#
Provider=Microsoft.ACE.OLEDB.12.0;
 
Data Source=C:\Temp\F1\Docs\Expeditors Project\Table1.accbd;
 
Share this answer
 
Comments
ZurdoDev 6-Jan-16 10:02am    
So, does this mean you have solved it? Because the connection string you just posted is not the same as the one in your question which means everyone was right, the path was incorrect as the error stated.
Member 11925473 6-Jan-16 10:14am    
the provider not path!

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