You should be using a parameterized query for this. You would create
the query string like:
SELECT (hrs) AS total_hours,(mins)AS total_mins FROM Timerecords WHERE
(workdate between @from and @to);
And then you would add two parameters to the SqlCommand you are
generating. You would then set the value of those parameters to the date,
and it will do the rest for you (as well as convert the date to a value that
is not dependent on the locale, which is what you are doing).
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
<je*@auto-soft.co.zawrote in message
news:11**********************@m36g2000hse.googlegr oups.com...
SELECT (hrs) AS total_hours,(mins)AS total_mins FROM Timerecords WHERE
(workdate between 02/06/2007 and 06/06/2007;
This statement doesn't work because it doesn't have times associated
with the dates.When i store the dates in the database originally it
automatically adds time to them is there anyway i can just enter dates
without the time.Any code examples please! thanks.