Reputation: 117
Experts,
I have a datatable with two columns:
1) One is Decimal
2) One is String
I write my filter query like:
var iFilterResult = from c in dataTable1.AsEnumerable()
where c.Field<string>("ACM_ACCOUNT_CODE").Contains(txtFindPrePaidExpenses.Text)
&& c.Field<string>("ACM_ACCOUNT_DESC").Contains(txtFindPrePaidExpenses.Text)
select new
{
ACM_ACCOUNT_CODE = c.Field<string>("ACM_ACCOUNT_CODE"),
ACM_ACCOUNT_DESC = c.Field<string>(" ACM_ACCOUNT_DESC")
};
gvSearchAccountGL.DataSource = iFilterResult;
gvSearchAccountGL.DataBind(); "
Here dataTable1
is Datatable Having Column
ACM_ACCOUNT_CODE
of decimal type
ACM_ACCOUNT_DESC
of string type.
use like Query for filter.
But it is not working
Upvotes: 0
Views: 379
Reputation: 1500225
You're trying to use ACM_ACCOUNT_CODE as a string field - but you've said it's a decimal field.
It's not clear why you'd expect a decimal field to contain the same value as the description field. If you really want this, you could use:
c.Field<decimal>("ACM_ACCOUNT_CODE")
.ToString()
.Contains(txtFindPrePaidExpenses.Text)
... but I suspect you should rethink what the query is trying to do.
Upvotes: 2