public partial class EnterData : Form
{
OleDbConnection myconn=new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Buddiez\Documents\Visual Studio 2010\Projects\working with databse\working with databse\database.accdb");
public EnterData()
{
InitializeComponent();
}
private void EnterData_Load(object sender, EventArgs e)
{
}
private void btn_Save_Click(object sender, EventArgs e)
{
string connString = string.Format("insert into test_database values('{0}','{1}','{2}','{3}','{4}')", Convert.ToInt32(txtsno.Text), txtName.Text, Convert.ToInt32(txtage.Text), txtBackground.Text, txtAddress.Text);
OleDbCommand myConn = new OleDbCommand(connString, myconn);
try
{
myconn.Open();
myConn.ExecuteNonQuery();
MessageBox.Show("Entry Updated");
myconn.Dispose();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
我已经将配置管理器配置到任何CPU,甚至我面临同样的问题Microsoft.ACE.OLEDB.12.0未注册到本地机器...指导我..
答案 0 :(得分:4)
听起来您需要安装Microsoft Access数据库引擎2010可再发行组件。这将安装所有必需的依赖项,以使Access OLEDB驱动程序正常工作。