는 UI 조인 :를 사용하여 동적 LINQ 도서관은
그리고 이것은 내가 동적 화재로 사용하고 코드입니다 절 : 만든 위의 코드 필터에서
public void bind()
{
string filter = "";
if (!string.IsNullOrEmpty(txtPart.Text))
{
filter = filter + "masterinv.inv_item_id = " + txtPart.Text;
}
if (!string.IsNullOrEmpty(txtDescription.Text))
{
if (!string.IsNullOrEmpty(filter))
{
filter = filter + " || masterinv.description = " + txtDescription.Text;
}
else
{
filter = filter + "masterinv.description = " + txtDescription.Text;
}
}
if (!string.IsNullOrEmpty(txtVendor.Text))
{
if (!string.IsNullOrEmpty(filter))
{
filter = filter + " || vendor.vendor_name = " + txtVendor.Text;
}
else
{
filter = filter + "vendor.vendor_name = " + txtVendor.Text;
}
}
InventoryDataContext dc = new InventoryDataContext(InventoryDBContext.GetConnectionstring());
var searchResult = (from masterinv in dc.OMS_REF_Master_Inventories
join vendor in dc.OMS_REF_Vendors on masterinv.inv_item_id equals vendor.inv_item_id
Where(filter)
select new OMS_REF_Master_Inventory
{
inv_item_id = masterinv.inv_item_id,
description = masterinv.description,
unit_of_measure = masterinv.unit_of_measure,
lot_id = masterinv.lot_id,
serial_id = masterinv.serial_id,
mfg_id = masterinv.mfg_id,
mfg_item_id = masterinv.mfg_item_id,
item_status_current = masterinv.item_status_current,
cm_unit_cost = masterinv.cm_unit_cost,
sync_dte = masterinv.sync_dte
}).ToList();
searchResult;
}
콤보 상자와 텍스트 필드의 조합을 기준으로 선택. 이러한 하나 개의 필터의 출력
이다 :이 다를 수
masterinv.inv_item_id = 'A' || masterinv.description = 'F' || vendor.vendor_name = 'V'
가 콤보 값 선택에 의존한다. 콤보 상자의 모든 사례는 BuildQueryFilter 메서드에 있습니다.
문제 :
나는 조항이 가입의 경우 해고 할 수 없습니다입니다. 내가 어디로 잘못 가고 있니?
중단 점을 넣고 마지막 필터 절이 무엇인지 확인하십시오. – tarzanbappa
이것은 내가 얻는 필터입니다 : '% A %'와 같은 masterinv.inv_item_id 또는 'F %'와 같은 masterinv.description 또는 '% V'와 같은 vendor.vendor_name – Sunny
콤보 상자 값 선택에 따라 달라질 수 있습니다. – Sunny