更新时间:2023-12-05 11:06:46
您的网格是如何设置的?
我会
a)设置bindingsource 如何:将数据绑定到Windows窗体DataGridView控件 [ ^ ]并将DataSource绑定到DataGridView
b)首先,你从数据库'表A'加载创建并加载一个DataTable'DataTable_A',然后将BindingSource.DataSource设置为'DataTable_A'
myBindingSource.DataSource = DataTable_A;
c)当你选择行并获取数据时,假设你将数据加载到一个DataTable'DataTable_B'。
d)然后你将BindingSource .DataSource更改为DataTable_B
myBindingSource。 DataSource = DataTable_B;
e)(现在,我不确定在这个阶段你有没有o强制刷新DataGridView),但是,你应该在DataGridView中有DataTable_B信息
这些是粗略的步骤 - 我认为它'可行' ,你可能需要研究一下来充实更精细的点
How is your grid set up ?
I would
a) set up a bindingsource How to: Bind Data to the Windows Forms DataGridView Control[^] and bind the DataSource to the DataGridView
b) to start with, you load create and load a DataTable 'DataTable_A' for example from Database 'Table A', and set the BindingSource.DataSource to this 'DataTable_A'
myBindingSource.DataSource = DataTable_A;
c) when you select rows and get data, lets say you load that data to a DataTable 'DataTable_B'.
d) Then you change the BindingSource .DataSource To DataTable_B
myBindingSource.DataSource = DataTable_B;
e) (now, Im not sure at this stage wether you have to force a refresh of the DataGridView), but then, you should have the DataTable_B info in the DataGridView
These are rough steps - I think its 'do-able', you may need to research a bit to flesh out the finer points