[英]Update Sql Table from datagridview c#
Hi I have a datagriview and I add it a data source of a sql table 嗨,我有一个datagriview,我添加了一个sql表的数据源
this.fletera_facturasTableAdapter.Fill(this.indarDataSet2.fletera_facturas);
// TODO: This line of code loads data into the 'indarDataSet1.fletera_facturas' table. You can move, or remove it, as needed.
and in the event of keypres i want to update the changes to sql if the user press "Enter" key on cell this: 在keypres的情况下,我想更新的变化为sql如果用户按下此单元格“Enter”键:
private void update_sql(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
fletera_facturasTableAdapter.Update(indarDataSet2.fletera_facturas);
}
}
i don't get any error but the sql table doesn't update 我没有得到任何错误,但sql表不更新
I find out the solution I just need to add this line 我找到了我只需添加此行的解决方案
private void update_sql(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
fletera_facturasTableAdapter.Update(indarDataSet2.fletera_facturas);
**indarDataSet2.fletera_facturas.AcceptChanges();**
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.