mercredi 4 juin 2014

Save GridData changes to sqlite table


Vote count:

0




when I load form I have this code:



private void AdminForm_Load(object sender, EventArgs e)
{

string path = Path.GetDirectoryName(Application.ExecutablePath);
string database = path + @"\DataBaseForCPP.db";
SQLiteConnection m_dbConnection;

m_dbConnection = new SQLiteConnection("Data Source=" + database + ";Version=3;");
// m_dbConnection.Open();



string sql = "select * from Vprasanja;";

try
{
m_dbConnection.Open();
DataSet ds = new DataSet();
var da = new SQLiteDataAdapter(sql, m_dbConnection);
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
catch (Exception)
{
throw;
}
}


The table is shown in my dataGridView1, so now I need to make a button, to save changes when I'm done changing data in dataGridView1. So when I press button1 the date in table must be updated with these in dataGridView1.


Thank you for help!



asked 34 secs ago






Aucun commentaire:

Enregistrer un commentaire