-
-
Notifications
You must be signed in to change notification settings - Fork 239
Open
Description
Hello,
I have a bunch of DataTables I need to query dynamically.
I have a GenerateClause function that generates a simple where clause based on the type of column being queried...
For example, a String column might look like (City = "Seattle")
and an Int32 field might look like (Size = 3)
However, the string field where clause works fine - but the Int32 field does not work - and generates an error "Specified Cast is not Valid"
Any thoughts as to what might be causing this error message? I will need to put DataTime, Doubles, DateOnly, etc. where clauses as well as the String and Int32.
Here is the code I am using - where the GenateWhereClause is used to gen the string containing the actual clause...
DataTable ColumnSelTable = dataSet_DataCleaning.Tables["RemoveByCol"];
CurrWhereClause = GenerateWhereClause(ColumnSelTable);
var dynamicQuery = CurrTable.AsEnumerable().AsQueryable();
var dynamicQuery2 = dynamicQuery.Where(DynLinqConfig, CurrWhereClause).ToList();
ResultingDataTable = dynamicQuery2.CopyToDataTable();Metadata
Metadata
Assignees
Labels
No labels