[英]How to Save GridView Data's to Access Database in Winforms DevExpress?
I Have GridView in the Form and Attached DataSource to it. 我在窗体中有GridView并将其附加了数据源。 1st Column having Repository_Grid_Lookup_Edit and Attached DataSource to it.
第一列具有Repository_Grid_Lookup_Edit并附加了数据源。 I perform Some Calculation and Obtain some results.
我执行一些计算并获得一些结果。 So now Totally 5 Rows and 6 Columns in the gridView.
所以现在在gridView中总共有5行和6列。 I have Save Button in the same Form, If i click Save Button I want to Store All this Data's to New Table in the GridView ??
我在同一表格中有“保存”按钮,如果单击“保存”按钮,我想将所有这些数据存储到GridView中的“新表”中? How to Complete my Task.
如何完成我的任务。
Thanks in Advance. 提前致谢。 Sri
斯里
The GridView is just a View on the datas which you DataSource holds. GridView只是DataSource所保存数据的View。 So if you change some value in the GridView the underlying DataSource automaticly changes the value.
因此,如果您在GridView中更改某些值,则基础数据源会自动更改该值。 I recommend you to build a class which represents one data set.
我建议您建立一个代表一个数据集的类。 Then you create a
List<MyClass>
and use this as DataSource. 然后,创建一个
List<MyClass>
并将其用作数据源。 So your BusinessObjects change automaticly if someone edit a value in the Grid. 因此,如果有人在网格中编辑值,您的BusinessObjects会自动更改。
To your question: If you want to show the data in a new Table just create a new Grid and populate the List<MyClass>
again. 问题:如果要在新表中显示数据,只需创建一个新的网格并再次填充
List<MyClass>
。 If you want to show the saved data only clone you List<MyClass>
on SaveButton Click and populate it. 如果要仅显示已保存的数据克隆,请在SaveButton上单击
List<MyClass>
单击并填充它。
I hope i understand you. 我希望我能理解你。 If you need further help i post an short example.
如果您需要进一步的帮助,我会举一个简短的例子。
regards 问候
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.