Datagrid View适配器保存和更新 [英] Datagrid View adapter save and update

查看:95
本文介绍了Datagrid View适配器保存和更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的datagrid视图适配器中,根据where条件选择数据。同时我需要添加一个或两个新的行值并在相同的where条件下更新。我怎样才能做到这一点。任何人都指导我

In my datagrid view adapter select the data based on the where condition. And at the same time I need to add one or two new row values and update in same where condition. How can I do this. Anyone guide me

推荐答案

确定,首先让我知道如何在SQL中插入一条带有变量的Where条件的新记录?



您不必担心标准位置,当您从UI传递值时,只需在数据库中插入记录:)是不是很简单?
ok, First let me know how could you insert a new record in SQL with Where criteria with variables ?

you don't have to worry about where criteria, when you are passing values from UI, just insert record in database :) Isn't that simple?


您好,

如果我没有错,您想要更新以前的记录以及在数据库中插入新记录。我认为您可以在datagridview中使用一个额外的列以及其他列,这些列将存储记录的状态,无论是更新还是插入(第一次)。假设为0表示插入,1表示更新。现在,传递Store过程或sql中的列值。并检查值是否为0然后运行插入查询或运行更新查询。
Hello ,
If I am not wrong you want to update the previous record as well as insert the new record in database . I think you can use one extra column in the datagridview along with the other columns , which will store the status of the record , whether it was updated or inserted(for first time). Say 0 for Insert and 1 for Update. Now , pass the column value in Store procedure or sql . and check if the value is 0 then run the insert query or else run update query .


这篇关于Datagrid View适配器保存和更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆