Thread: Datetime Substitutions

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    1

    Datetime Substitutions

    I am trying to substitute a null date value (Blasted 12/30/1899) in my select statement. I am using VS 2003 C#. The datasource is Foxpro.
    Any ideas !

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Either they never fixed that natural gas leak and my brain is chemically reacting to form styrofoam, or this is more of an SQL question. Am I right? In which case, what exactly is your problem?

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Can you be a bit more precise ? What you describe is normally done by using a simple if statement.

    string sql;

    if( yourDateVariable == yourDateNullValueConstant )
    {
    sql = "select * from table where date is null";
    }
    else
    {
    sql = "select * from table where date = " + yourDateVariable.ToString();
    }

    Format the date value according to your database system and date functions / country specifics.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to pass in an array/struct as argument
    By Tom_Arch in forum C Programming
    Replies: 11
    Last Post: 04-23-2009, 04:16 PM
  2. Getting only Date by using DateTime ?
    By Aga^^ in forum C# Programming
    Replies: 3
    Last Post: 02-11-2009, 01:20 AM
  3. mySQL Datetime
    By Creini in forum C Programming
    Replies: 1
    Last Post: 10-22-2006, 01:32 AM
  4. DateTime and TimeSpan ..... help please.
    By fingerlickin in forum C# Programming
    Replies: 1
    Last Post: 10-11-2005, 12:11 PM
  5. DateTime problem in template query (mysql++)
    By _Ramirez_ in forum C++ Programming
    Replies: 0
    Last Post: 04-07-2005, 09:01 AM