I am getting error like “Assign: Conversion from string “” to type ‘Double’ is not valid.” after reading the excel sheet.
this is the logic
(From r In Dttime.AsEnumerable
Where datetime.FromOADate(CDbl(r(“Time”).ToString)).ToString(“HH:mm:ss”) > “06:00:00” And datetime.FromOADate(CDbl(r(“Time”).ToString)).ToString(“HH:mm:ss”) < “11:59:59”
Select r).CopyToDataTable
It should filter the data with in the given time.
@Harish_pavuluri - Based on the excel sheet you provided in the below post, this should work without any error…If your column has Null or Space value it will throw an error which you have to handle this before filtering the data
screenshot of the filtered sheet with 678 rows out of 1878 rows in the sheet1
Plz check with this excel, I got this format recently. Party wise cumulative Report.xlsx (279.4 KB)
In for each loop I used massage box for checking the out put of the data it is showing same 0.78 and 0.89 something like.
@Harish_pavuluri - As i suspected there is blank value in the Time Column and that’s why it was failing. Have you checked and made any attempt to remove it??
(From r In Dttime.AsEnumerable
Where datetime.FromOADate(CDbl((r(“Time”).ToString)).ToString(“HH:mm:ss”)) > “06:00:00” And datetime.FromOADate(CDbl((r(“Time”).ToString)).ToString(“HH:mm:ss”))< “11:59:59”
Select r).CopyToDataTable
Can you try with the above query, I have added one more parenthesis while converting into Double.
@Harish_pavuluri - Either you can remove it manually or apply the filter as I shown above, after filtered just pass the filtered dt existing codes…it is working fine…I have already tested it.