Hi @Ishan_Ranasinghe ,
You would need to perform correction with the variable types and keep the type as DateTime
instead of String.
Start_Date=now.Date.AddDays(-7)
End_Date=now.Date
Here, Start_Date
and End_Date
are DateTime
type variables.
Then For Filtering, Could you check the below Expression :
DT = DT.AsEnumerable.Where(Function(x)Start_Date<=CDate(x("Transaction_Date").ToString) andAlso CDate(x("Transaction_Date").ToString)<=End_Date).CopyToDatatable
Here, DT
is the Datatable variable.
For Errors on Direct CopyToDatatable, Check the below post :