kaushik guru

kaushik guru

  • 1.4k
  • 252
  • 27.3k

dynamically search db using linq

Apr 17 2023 4:56 AM

Dear Team i have a mysql table like below

id , firstname, lastname, location, dateofinterview 

and i using one dropdown , 1 textbox and two date field to search the result from db

here the location is dropdown and i will always have a value greater than 0 in the db but in dropdown its default is 0 , the text box has to search any work like (contain) keyword in mysql from both firstname and last name 

and the two date column will search from date of interview column 

here lets say is the from date is empty then the from date should be negative 30 days from today and if to date is empty then the to date should be 30 days from today and if from and to are given the rows that matched between the dates should appear 

one more stopper : if location is not given then the matching values from other search criteria should appear 

i am trying to write it in linq and i am struck in the dropdown and the date part 

kindly help.


Answers (7)