我是使用LiNQ的新手。我有以下代码,用于查找发票对象上零件的订单数量。查询结果来自LiNQ查询
var invoiceQty = from i in returnInvoices
where i.PartNo == returnPart.PartNo && i.InvoiceID == hiddenInvoiceId.Value
select i.OrderLineQty;
if (Convert.ToInt32(txtReturnProdQty.Text) > Convert.ToInt32(invoiceQty))
{
args.IsValid = false;
SourceValidate.ErrorMessage = "Returned qty cannot be greater than quantity available on the invoice.";
txtReturnProdQty.Focus();
return;
}
我不认为我正确地获得OrderLineQty
值if语句,因为它会产生以下错误:
System.InvalidCastException: Unable to cast object of type 'WhereSelectListIterator`2[Invoice,System.Double]' to type 'System.IConvertible'.
谁能帮助我了解如何使用返回值在LiNQ查询中?
LiNQ需要一段时间才能沉入水中!
[呈三角问题] [1] [1]:http://stackoverflow.com/questions/792412/unable-to-cast-object-of-type-system-data-linq-dataquery1system-int32-to-ty 可能是你获得多重价值 – user1964763 2013-02-27 16:21:24