简体   繁体   中英

How to retrieve desired date from access database using C#

I'm working on access database using C#, want an SQL statement to select all information based on a desired date. for example today.

"SELECT * from mytable where mytable.dates == DateTime.Today()";

If I understand the question right and you want to make a call to the SQL Server, you can use SQLCommand and parameters.

var sqlCommand = new SqlCommand();
sqlCommand.CommandText = "SELECT * from mytable where mytable.dates= @DateAdded";
sqlCommand.Parameters.AddWithValue("@DateAdded", DateTime.Today);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM