本文介绍了组合框未显示winform中的当前记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Penyusutan
Penyusutan
ID as nvarchar(10)
AccCode as nvarchar(10)
Price as Decimal(10,2)
ID AccCode Price
001 1-2000 100
002 1-3000 200
AccountCode
AccountCode
AccCode as nvarchar(10)
Description as nvarchar(50)
AccCode Description
1-1000 Chair
1-2000 Table
1-3000 Computer
之间的关系2桌子(Penusutan.AccCode => AccountCode.AccCode)
relationship between 2 tables (Penusutan.AccCode => AccountCode.AccCode)
private void fPenyusutan_Load(object sender, EventArgs e)
{
var p = from c in ct.Penyusutans select c;
penyusutanBindingSource.DataSource = p.ToList();
var j = from d in ct.AccountCodes select
new { d.AccCode, d.Description };
accCodeComboBox.DataSource = j.ToList();
accCodeComboBox.ValueMember = "AccCode";
accCodeComboBox.DisplayMember = "Description";
}
问题是:
第一记录ID = 001,AccCode(ComboBox) =椅子< ===必须是(表)
在第二个记录组合框中正常工作ID = 002,AccCode =Computer
the problem is :
First Record ID = 001, AccCode (ComboBox) = "Chair" <=== It must be ("Table")
in second record combobox is working normally ID=002, AccCode = "Computer"
推荐答案
var j = from d in ct.AccountCodes
join p in Penyusutanon d.AccCode equals p.AccCode select
new { d.AccCode, d.Description };
您应该使用linq join操作。
You should use linq join operation.
这篇关于组合框未显示winform中的当前记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!