how can i update an access database
how can i update an access database with data from textbox
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Kirtan PatelPosted Dec 12, 2009, 2:31 PM
Here is sample code for Updating Access Database just take reference of it :)
i have commented the code for your understanding ..
if still you have doubt then let me know :) i will help you.
if my answer helps you then dont forget to check "do you like this answer" check box :)
using System.Data.OleDb;
private void Updatebutton1_Click(object sender, EventArgs e)
{
string yourValueForField = "test";
//Connection String
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database1.accdb;Persist Security Info=True");
//Open the Connection
con.Open();
OleDbCommand comm = new OleDbCommand("update TableName set Username=@username where id=5", con);
comm.Parameters.AddWithValue("@username", yourValueForField);
//Execute the Query on Database
comm.ExecuteNonQuery();
//Close the Connection
con.Close();
}