0
我有一个列表框,它是数据绑定到accdb文件并显示一列的内容,它链接到的dataBindingSource也被过滤 - 这可以正常工作(但可能会影响什么我即将问)。例如,我想知道如何从所选项目的全部记录中提取一个值。列表框当前显示的是姓氏 - 这就是你能看到的所有信息,我怎样才能提取未显示但存在于数据绑定源中的客户姓名?从列表框中获取数据源
这是代码中使用的填充列表框:
public frmCustomer(string Input)
{
InitializeComponent();
this.customersTableAdapter.Fill(this.dSSystem.Customers);
this.catsTableAdapter.Fill(this.dSSystem.Cats);
// Display Customer Record
int lvRecIdx = customersBindingSource.Find("AccRef", Input);
customersBindingSource.Position = lvRecIdx;
// Fetch Cats Owned
catsBindingSource.Filter = ("CustRef = '" + Input + "'");
}
谢谢
请同时给我们展示一些代码并确保为WPF/Asp.NET/WinForms附加标签,以便您得到正确答案。 –
在这种情况下,您应该从数据源中选择2列访问数据库。你也应该选择表的“主键”。 –
@FabianBigler我目前没有任何代码显示,因为我不确定如何引用该记录中的另一个字段,如果有帮助,我添加了用于填充列表框的代码。 – MrDKOz