User447704385 posted
Please help to debug this error: The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.
I created this project on 64 bit VS 2008 SP1, .Net framework SP1.
I have office 2007 (32 bit) installed.
Thanks.
web.config:
<add name="DBConnectionString1" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\MyDB\MyDB.accdb; Persist Security Info=False;" />
c# code:
protected void InsertData(string[] CaseN, string[] TestI, string[] TestC)
{
String myConn = ConfigurationManager.ConnectionStrings["DBConnectionString1"].ToString();
OleDbConnection con = new OleDbConnection(myConn);
OleDbCommand cmd = new OleDbCommand();
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = con;
con.Open();
for (int i = 1; i <= 3; i++)
{
String stmt = "insert into [PET FISH-log 2010] values ('" + CaseN[i] + "', '" + TestI[i] + "', '" + TestC[i] + "')";
cmd.CommandText = stmt;
try
{
cmd.ExecuteNonQuery();
}
catch (Exception myExep)
{
con.Close();
TextBox1.BackColor = Color.Red;
TextBox1.Text = stmt;
TextBox2.Text = myExep.ToString();
}
}
con.Close();
con.Dispose();
}