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

Can anybody tell me how to display latest data first in datagridveiw, when an event occurs. Like an event is triggered @ regular intervals in an application i have developed in windows form. In this form as & when a event is triggered its date time is noted & populated in the datagridview, i am able to display the latest data in the last row but what i require is i want to display this latest event in the top row & earlier events that occured in the consecutive locations.

Thanks in advance
Posted
Comments
Thanks7872 14-Jul-14 2:35am    
Its not clear why you consider event in order to sort out data? And what events are you talking about? How it prevents you to display data?
jo.him1988 14-Jul-14 2:41am    
hi, this is not depend on what is your datagridview and what event fire , its depend on how you are binding your grid, make sure your bind query have order by clause with desc order i.e datetime, salary etc

1 solution

HI,
i haven't too much idea about window form (i works web).

i thanks you can ..

in table you sud have a column with name LastUpdatedDateTime or CreatedDateTime

now in your sql Query add a clouse ORDER BYCONVERT(DateTime, LastUpdatedDateTime ,101) DESC
 
Share this answer
 
Comments
Jagadisha_Ingenious 14-Jul-14 2:46am    
@S.K.Tripathi: What is 101 in your SQL query?
ArunRajendra 14-Jul-14 2:54am    
The result can be achieved even without using the convert function.

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