Basically, I’m working on something and I need to get a specific row of the excel file if the “Reminder Date” column matches the current date of the world. I got the part of matching the reminder date to the current date but how do I extract the whole row? That’s my question Please help me thanks!
Try the below query to get the entire row. It will returns first matching row if more than one match found.
datarow_object = (from x as datarow in yourDatatable where convert.ToDateTime(x("column name")).ToString.Equals(yourDate) select x).first
I tried it but I keep getting this message and when I insert “Reminder Date” into the Column Name, it says it doesnt exist when it does
Can you tell me what is the source of your datatable “dt1”. Are you getting dt1 from excel sheet directly or by web scraping ? .
Instead of using column name try with column index row(column index) Eg. row(0)
If possible share your excel file and also CurrentDataarr value here.
I am using an excel sheet directly.
I tried it but it still can’t work for me
what do you mean by CurrentDataarr? and here’s my excel sheet
HR.xlsx (12.3 KB)
CurrentDataarr(0) you have used this value to compare in the query.
Well the problem is the first row in your excel sheet. So can you please read data from the range A2 with Add Header property enabled.
Process.xaml (24.4 KB)
Well, the same error keeps popping despite the changes, can you take a look at my process file? I’m really confused thanks alot for helping me
Its working for me . please check this xaml Process.xaml (10.5 KB)
Issue in your code.
You have given the index value with quotes surrounded Eg row(“8”) . Column index should be without quotes Eg row(8).
Try to display the both values before comparing , since you are comparing only after converting date variable into string.
Thanks man it works now! you helped me a lot