Answer the question
In order to leave comments, you need to log in
DataGridView save changes to DB - C#?
Good morning! Tell me how, when I click on the "Save" button, save the changes to the database that I made in the DataGridView.
This is how I get the data:
public DataTable SelectNowYear()
{
DataTable dt = new DataTable("table");
SQLiteConnection connection = new SQLiteConnection(connect_db);
SQLiteCommand command = new SQLiteCommand("SELECT * FROM `"+ tablename +"` WHERE Year="+year, connection);
connection.Open();
SQLiteDataAdapter dAdpt = new SQLiteDataAdapter(command);
dAdpt.Fill(dt);
connection.Close();
return dt;
}
Answer the question
In order to leave comments, you need to log in
When using ADO.NET, you shouldn't have much trouble changing data in the database. See related links: Getting and modifying data
in
ADO.NET
Updating
data sources using Da objects... updating data in the database.
PS For data security, I advise you to prohibit the execution of queries and use only procedures.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question