如何将数据从列表视图发送到数据库?

问题描述:

您好,我有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

}