|
-
August 24th, 2011, 09:44 AM
#3
Re: datetimepicker and sql
Greetings,
While I have not used the BETWEEN or been in SQL (oracle dates act a little differently)... this is one way to handle query string manipulation... to construct your query, you could use the String.Format() method and 'insert' the date values this way...
Code:
// query text without the date parameters, just place holders...
string rawQuery = "SELECT punches.Number, punches.Punchdate, employees.Name FROM employees CROSS JOIN punches WHERE punches.PunchDate BETWEEN '{0}' AND '{1}'";
// throw your date values into the placeholders to produce your executing query...
string filledQuery = String.Format(rawQuery, DateTime.Today.ToShortDateString(), DateTime.Today.ToShortDateString());
(of course, using yor datepicker values rather than DateTime.Today....)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|