Here are some tutorials that i gathered from net. Some are as old as 5 years but all of them are great.So read them and learn from them use your brains and things will work for you.
List of tutorials that can help you :
You can download the sample Zip file and try it. Coder stats that he wrote a code to abstract the dbase access for C++ using its COM object. It will be better to read the info file before trying it, the link is here.
To connect MS Access 2010 VIA C#
In case if you are using Jet Engine 4
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False;
Your ads will be inserted here byEasy Plugin for AdSense.Please go to the plugin admin page toPaste your ad code OR Suppress this ad slot.
To edit using C#
Here is the example code
private void Window_Loaded(object sender, RoutedEventArgs e)
{
}
private void button3_Click(object sender, RoutedEventArgs e)
{
OleDbCommand cmd = new OleDbCommand("INSERT INTO tbl_Fullname (Lastname,Firstname,Middlename) VALUES (@first,@last,@midn)",conn);
conn.Open();
cmd.Parameters.Add("@first", OleDbType.VarChar).Value = textBox1.Text;
cmd.Parameters.Add("@last", OleDbType.VarChar).Value = textBox2.Text;
cmd.Parameters.Add("@midn", OleDbType.VarChar).Value = textBox3.Text;
cmd.ExecuteNonQuery();
conn.Close();
}
private void textBox4_TextChanged(object sender, TextChangedEventArgs e)
{
conn.Open();
OleDbCommand cmd2 = new OleDbCommand("SELECT fnID,Lastname,Firstname,Middlename FROM tbl_Fullname WHERE fnID= @id", conn);
cmd2.Parameters.Add("@id", OleDbType.VarChar).Value = textBox4.Text;
try
{
OleDbDataReader dr = cmd2.ExecuteReader();
if (dr.Read())
{
textBox1.Text = dr[1].ToString();
textBox2.Text = dr[2].ToString();
textBox3.Text = dr[3].ToString();
textBox5.Text = dr[0].ToString();
}
else
{
MessageBox.Show("No result");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
conn.Close();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
conn.Open();
OleDbCommand cmd = new OleDbCommand("UPDATE tbl_Fullname SET Firstname=@firstn,Lastname=@lastn,Middlename=@midn WHERE fnID=@idn", conn);
cmd.Parameters.Add("@idn", OleDbType.VarChar).Value = textBox5.Text;
cmd.Parameters.Add("@firstn", OleDbType.VarChar).Value = textBox1.Text;
cmd.Parameters.Add("@lastn", OleDbType.VarChar).Value = textBox2.Text;
cmd.Parameters.Add("@midn", OleDbType.VarChar).Value = textBox3.Text;
cmd.ExecuteNonQuery();
conn.Close();
}
}
If you want to know how to connect Ms access and Visual C++ (2008). Follow the link to read step by step method.