How can I use .NET DataSet.Select method to search records that match a DateTime? What format should I use to enter my dates in?
            From stackoverflow
            pgb
        
    - 
                        The best method is dd MMM yyyy (ie 15 Sep 2008). This means there is no possiblity of getting it wrong for different Locals. ds.select(DBDate = '15 Sep 2008')You can use the DateFormat function to convert to long date format as well and this will work fine too. From Leo Moore
- 
                        I use the following for the SQL Select: public string BuildSQL() { // Format: CAST('2000-05-08 12:35:29' AS datetime) StringBuilder sb = new StringBuilder("CAST('"); sb.Append(_dateTime.ToString("yyyy-MM-dd HH:mm:ss")); sb.Append("' AS datetime)"); return sb.ToString(); }From creohornet
 
0 comments:
Post a Comment