c# - Only display dates after current date from database in datagridview -


so have database, , querying list of events , there dates. want change query return events have not occured.

my query @ moment is:

cmd.commandtext = "select eventid, eventdate, location events"; 

and inputs datagridview.

i tried:

cmd.commandtext = "select eventid, eventdate, location events eventdate > curdate()"; 

but didnt return dates.

here have approach both mssql , mysql since did not specify dbms using.

mssql:

you can use getdate(). should give current date , time.

cmd.commandtext = "select eventid, eventdate, location events eventdate > dateadd(dd, datediff(dd, 0, getdate()), 0)"; 

mysql:

you can use now() function, , truncate time part casting date.

cmd.commandtext = "select eventid, eventdate, location events eventdate > cast(now() date))"; 

Comments

Popular posts from this blog

C# random value from dictionary and tuple -

cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -