DataTable questions

  • Thread starter Thread starter Krish
  • Start date Start date
K

Krish

I am populating date and time into a date time, this is for a intra day price
series. Would you recommend that I use "string" data type for both date and time.

Also how do I query prices for a given date, I did

DataRow[] rows = dt.Select("priceDate = 6/1/2004","priceValue");

Could someone please help me with the syntax.

Is it true that there are no date and time datatypes in C# ?

regards
 
Krish,

I would recommend that you use a DateTime to store the date and time
together. It doesn't make sense otherwise. You would have to create a
format to store it in that is neutral to location, etc, etc,.

If you want to query for a given date in a DataTable, then you could
have your query be:

priceDate >= #6/1/2004# and priceDate < #6/2/2004#

The general expression is:

priceDate >= (date) and priceDate < (date + 1)

This should be easy to do with an instance of DateTime that you want to
search against.

Hope this helps.
 
Back
Top