I am trying to insert data to Access 365 in .net core API. Below is what I did to insert the data, but I am getting an error saying that :
The type or namespace name 'OleDbConnection' does not exist in the namespace 'System.Data.OleDb' (are you missing an assembly reference?)
I added the assembly reference to :
using System.Data;
using System.Data.Odbc;
using System.Data.OleDb
Below is my partial C# code:
public void PrimeAccessRules()
{
List<RecLoad> recList = new List<RecLoad>();
recList = getPrimeData();
System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;" +
@"Data source= C:\Users\test\recload.accdb";
try
{
conn.Open();
}
}
The error is coming right on this line:
System.Data.OleDb.**OleDbConnection**
saying that OleDbConnection does not exists
Any help will be highly apprecaited.