如何将数据从列表视图发送到数据库? [英] How do I send data from a list view into a database?
本文介绍了如何将数据从列表视图发送到数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我有4个列表视图,其中包含可由用户编辑和删除的某些数据.问题是所有编辑完成后,他们很高兴如何将其提交给数据库.我知道您如何插入数据库等,只是不确定如何从列表视图执行一组数据.]
在此先感谢
Hi, I have 4 list views containing certain data that can be edited and delete by the user. The question is once all the editing is done and they are happy how do I commit it to the db. I know how you INSERT to db''s etc just not sure how to do a group of data from a listview.]
Thanks in advance
推荐答案
好,有两件事.
第一:如果数据库中有数据,是否应该将其覆盖?最好从db中删除,然后将listview中的每个项目插入到db中.
所以:
首先在数据库中删除
然后对于每个listview对象:
well there is two things.
first: if there is data in the db should it be overwritten? Better to remove from db and insert each item from listview to db.
so:
first delete in DB
and then for each listview object:
foreach(var item in ListView1.Items)
{
// set the values to sqlparameters
// insert in db
}
这篇关于如何将数据从列表视图发送到数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文