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
Post a Comment