I’ve question to ask.
I want to update table at backend in database through making changes in datagridview.
DataGridView changes should be reflected into the Database.
How can I achieve it?
Thank you…
Codes:
SqlCommand command;
if (con.State == ConnectionState.Closed)
con.Open();
string updateQuery = @"UPDATE Hucre set VericiKB=@VericiKB Where OrtamKB=@OrtamKimlikBilgisi and HucreKB=@HucreKB";
command = new SqlCommand(updateQuery, con);
command.Parameters.Add("@VericiKB", SqlDbType.Int, 50, "VericiKB");
SqlParameter param1 = command.Parameters.Add("@HucreKB", SqlDbType.Int, 50, "HucreKB");
SqlParameter param2 = command.Parameters.Add("@OrtamKB", SqlDbType.Int, 50, "OrtamKB");
param1.SourceVersion = DataRowVersion.Original;
param2.SourceVersion = DataRowVersion.Original;
da.UpdateCommand = command;
Where or what is da.UpDateCommand = command;..?
within that
refactor your code by wrapping Try Catch {} blocks
//when you are done release the SQLCommand objects