Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

i am displaying attendance detail in a gridview..but i want only one days entry..
means today what ever i am entering it should show that only..tomorrow if i open the form it should be an empty grid..
grid contains each days data only...

please tell me how to do this..
Posted

if you are ferching data from sql server or any backend to dispaly in gridview then you have to write query for that. Query should fetch the current dates data.
like
SQL
select * from table_name where date = getdate()
 
Share this answer
 
v2
Hi,

datagridview shows the data when we assign any table of dataset to it so if you are retreiving the date of attendance by a query so please put a where condition with date and compare it with Now.date so it will display the data of the current date and at the start of the day there will be no data so it will show an empty grid.
 
Share this answer
 
v2
For this you need to alter the way you are fetching data to bind the grid view.
For example, if you are using a stored procedure, you need to add certain condition , so that it will fetch only current date's data only.
And again , you should have a column in the table which will store the current date when you insert a new data to the table.
 
Share this answer
 
v2
u can do it in query level..pass he required date in query and then bind that data to the grid
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900