列表到数据库的每个项目

列表到数据库的每个项目

本文介绍了列表到数据库的每个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个清单



i have a list

List<SalesDetail>  SalesList = new List<SalesDetail>();
SalesDetail detail = new SalesDetail();  





其中SalesDetail是一个类。我有一个按钮(添加),我的代码点击事件的添加按钮是SalesList.Add(详情);其中details是SalesDetail类的对象,其中包含{set;并获得;}



但是当我尝试检索列表中的每个项目时,我只得到最后一项。检索每个项目的代码是





where "SalesDetail" is a class. i have a button (add) and my code on click event of add button is SalesList.Add(details); where details is object of class SalesDetail which contains public variables with {set; and get;}

but when i try to retrieve each item of the list then i only get the last item. my code retrieving each item is

foreach(SalesDetail sd in SalesList)
{

    messageBox.show(sd);

}




我班上的
SalesDetail我有以下代码



in my class SalesDetail i have following code

Public string Brand{get; set;}
Public string Product{get; set;}





i希望从列表中检索每个项目并将其保存到数据库我想知道我在检索时出错了数据..

请帮助

问候bunzitop



i want to retrieve each item from list and save it to database i would like to know where i have made mistake while retrieving the data..
please help
Regards bunzitop

推荐答案


这篇关于列表到数据库的每个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 18:47