Hi, with your previus help, I managed to get most of the things sorted out. now there is a problem with my DataGridView. When I update row in DataGridView, it stays there until i close the program, so I suppose, changes are only made to loaded DataTable. I searched alot for the solution on the internet, but nothing worked.
Here is the update function (only updating one row at the moment):
What am I doing wrong this time?
Thanks.
Here is the update function (only updating one row at the moment):
void update(int row) { DataGridViewCell cell = dataGridView2.CurrentCell as DataGridViewCell; if (cell.IsInEditMode) { string query; sqlcon.Open(); query = "update tabelaZaposlenih set ime='" + dataGridView2.Rows[row].Cells[1].EditedFormattedValue + "'"; sqlcmd = new SqlCommand(query, sqlcon); // i added this line afterwards, but no joy... sqlcmd.Parameters.AddWithValue("ime", dataGridView2.Rows[row].Cells[1].EditedFormattedValue); sqlcmd.ExecuteNonQuery(); sqlcon.Close(); MessageBox.Show("Podatki uspeno posodobljeni", "Podatki uporabnika"); } }
What am I doing wrong this time?
