| Author: Karthikeyan S 30 Aug 2008 | Member Level: Gold | Rating: Points: 6 |
Hi,
In button click event get the two dates value from the two text boxes and pass these value to sql query. Then use dataadapter to get the data from database to the dataset and set the datasource for the datagrid as dataset.
Here the important point is we have to write a query which will return active faculty names between the selected from and end dates.
Following is the sample query:
string lstrQuery = "SELECT ID, FacultyName FROM Faculty_Table WHERE Faculty_ActiveStartDate IS BETWEEN " + TEXTBOX1.TEXT + " AND " + TEXTBOX2.TEXT + " OR Faculty_ActiveEndDate IS BETWEEN " + TEXTBOX1.TEXT + " AND " + TEXTBOX2.TEXT
Note: If you find your requirement varies depending upon startdate and enddate, change the where condition accordingly.
|