Click here to Skip to main content
15,886,091 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
how to Automatic Adding Current Date and Time in the column datagridview use sql server in vb.net ?

please help
Posted
Comments
Noor Ahmad Feroozi 26-Feb-13 13:44pm    
Please be more specific in your question to get a better answer.
Thanks
joshrduncan2012 26-Feb-13 14:03pm    
What have you done to accomplish this task so far? Where are you stuck?
BC @ CV 26-Feb-13 14:05pm    
you could always just add this to a column in your SQL query: GetDate() AS [CurrentDate]

...But why would you want to display the current date in a grid since the entire column would contain the same value?
Dave Kreskowiak 26-Feb-13 15:10pm    
This makes no sense at all. You can't have a DateTime column automatically increment. There's no way to specify by how much you want to increment. For example, are we talking about incrementing by a nanosecond? A second? A minute? A day? A month? A millenium?

1 solution

In your SQL statement just return a new column with the current date and time. For example:
SQL
SELECT firstname, lastname, address, GetDate() as CurrentDateTime
FROM customerstable


Then your gridview can bind to it.
 
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