更新时间:2023-02-08 18:06:08
大家好,
感谢您的支持.我使用以下方法通过datagridview更新数据库:
Hi Guys,
Thanx for your supports. I have used the following way to update database with datagridview:
SqlDataAdapter adp = new SqlDataAdapter();
adp.UpdateCommand = con.CreateCommand();
adp.UpdateCommand.CommandText = "SQlQuery";
adp.UpdateCommand.CommandType = CommandType.Text;
adp.UpdateCommand.Parameters.Add("@a",SqlDbType.VarChar, 50).Value = DataGridView1.Rows[e.RowIndex].Cells[1].Value;
adp.UpdateCommand.Parameters.Add("@AdjAmt", SqlDbType.Float).Value = Convert.ToSingle(DataGridView1.Rows[e.RowIndex].Cells[5].Value);
adp.UpdateCommand.ExecuteNonQuery();
adp.Dispose();
问候!
Aman
Regards!
Aman
嗨Aman4.net,
此问题 [
Hi Aman4.net,
This Question[^] I guess could contains what you are searching for.
I hope this help,
:)
希望使用DataGridView更新数据库 [ ^ ]会给您一个想法.
Hope Update database with DataGridView[^]will give you an idea.