Once i filter with column2. Column 3 is for datetime so there i am facing issues while inserting null values into db so i tried adding to datatable with if condition .
Please refer screenshots from topic.
Could anyone help me as its urgent.
dtFiltered =
(From d in YourDataTableVar.AsEnumerable
Where Not (isNothing(d(“TrailerType”) OrElse String.isNullorEmpty(d(“TrailerType”).toString.Trim))
Select r = d).CopyToDataTable
(From d in YourDataTableVar.AsEnumerable
Where Not d.ItemArray.Any(Function (x) isNothing(x) OrElse String.isNullorEmpty(x.toString.Trim))
Select r = d).CopyToDataTable
Thanks for quick response.
I tried this logic its working fine for filtering data. But there is problem while uploading the same data to DB as 3rd column(variable type - DateTime) has null values, so i was considering it as an object while build datatable in my for loop logic and with that approach i was not facing any issue for upload datatime with null values which basically shown as “” in debug mode. Could you suggest me the additional logic for the same linq query.
please find attached screenshot for the error i am recieving now.
please find screenshots in topic for logic i implemented earlier.
How to maintain column1 as string,column2 as string, column3 as object and column 4 as string in the same linq while filtering.
May be that would solve my problem.
in our understanding this is another case. Filtering is working, so now you are looking on how to modify / preparing data for the uploading for empty dates
We would suggest to scope 1 topic = 1 case
give a try in a RnD if a nothing / DBNull.Value would work instead of empty string
Ok, but is not a filter case as origin this Topic was titled.
Filtering should work. So close this topic and open a new one with this new case. When scoping 1 topic = 1 case you help other researchers to find faster solutions for similiar cases. Thanks for support