How can i update an access database
how can i update an access database with data from textbox
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Dec 12, 2009, 9:31 AM EST
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();
}