1
I have a string connection to the Access database:
@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\lentes.accdb;Persist Security Info=False";
When I run this code always gives error " There is no support for the keyword 'Provider''."
P.S. has nothing after that code yet, that’s all:
string strcon = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\lentes.accdb;Persist Security Info=False";
SqlConnection con = new SqlConnection(strcon);
con.Open();
Then I run Try and catch to see the error and this error I said.
And also can not forget to remove the
Provider=...;
of the Connection string– Marcelo Shiniti Uchimura
@Marcelouchimura I believe that in this case the Provider is required. connetionstring for Oledbclient requires the Provider. https://docs.microsoft.com/en-us/dotnet/api/system.data.oledb.oledbconnection.connectionstring?view=netframework-4.7.2#System_Data_OleDb_OleDbConnection_ConnectionString
– William John Adam Trindade
Okay, William, it’s because you’re Oledb, you haven’t touched me. Thanks!
– Marcelo Shiniti Uchimura
Do you think you have to install the OLE DB provider from outside or it comes by default? Some 4 years ago, I messed with . accdb and had to install from outside
– Marcelo Shiniti Uchimura
Download the provider OLE DB Microsoft.ACE.OLEDB here: https://www.microsoft.com/en-us/download/details.aspx?id=54920
– Marcelo Shiniti Uchimura
Assembly System.Data.Oledbclient is native to .NET. What you may need to install is the Access driver, that’s the part. https://www.microsoft.com/en-us/download/details.aspx?id=13255
– William John Adam Trindade
Thank you, William!
– Marcelo Shiniti Uchimura