Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Date time storing null values

Date time storing null values

Scheduled Pinned Locked Moved Database
databaseannouncement
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rajiya
    wrote on last edited by
    #1

    Hi, I am having a stored procedure whose output directly binds to the datagrid. The procedure is having a select query as follows: SELECT P. Project_id as ID, P.Project_Name as Name , P.Project_version as Version , P.Project_Description as Description ,Convert (VarChar(15), P.projected_start_date,106) as ProjectedStartDate , Convert(VarChar(15),P.projected_end_date,106) as ProjectedEndDate,P.actual_start_date as ActualStartDate, P.actual_completion_date as ActualCompletionDate FROM tblProjects P INNER JOIN tblProjectType PT ON P.Project_Type_Id = PT.Project_Type_Id /*ORDER BY P. project_type_id*/ WHERE P.is_active=1 Here the ActualStartDate and ActualCompletionDate can have some mininum date value like '11/09/1753' or the actual dates entered by the user. If the ActualStartDate is '11/09/1753' then i want the to get it as null or empty string and then bind it to the datagrid. so in the datagrid under the ActualStartDate where '11/09/1753' is present, it will actually display null or empty. Thanks, Riz

    A 1 Reply Last reply
    0
    • R Rajiya

      Hi, I am having a stored procedure whose output directly binds to the datagrid. The procedure is having a select query as follows: SELECT P. Project_id as ID, P.Project_Name as Name , P.Project_version as Version , P.Project_Description as Description ,Convert (VarChar(15), P.projected_start_date,106) as ProjectedStartDate , Convert(VarChar(15),P.projected_end_date,106) as ProjectedEndDate,P.actual_start_date as ActualStartDate, P.actual_completion_date as ActualCompletionDate FROM tblProjects P INNER JOIN tblProjectType PT ON P.Project_Type_Id = PT.Project_Type_Id /*ORDER BY P. project_type_id*/ WHERE P.is_active=1 Here the ActualStartDate and ActualCompletionDate can have some mininum date value like '11/09/1753' or the actual dates entered by the user. If the ActualStartDate is '11/09/1753' then i want the to get it as null or empty string and then bind it to the datagrid. so in the datagrid under the ActualStartDate where '11/09/1753' is present, it will actually display null or empty. Thanks, Riz

      A Offline
      A Offline
      aamironline
      wrote on last edited by
      #2

      Compare ActualStartDate with DateTime.MinValue. if its same treat as null or empty...

      M Aamir Maniar aamirOnline.com

      R 1 Reply Last reply
      0
      • A aamironline

        Compare ActualStartDate with DateTime.MinValue. if its same treat as null or empty...

        M Aamir Maniar aamirOnline.com

        R Offline
        R Offline
        Rajiya
        wrote on last edited by
        #3

        ya...i knw that i have to compare the ActualStartDate with DateTime.MinValue But how exactly to do it in the stored procedure? Let me knw if u have got any solution. Thanks, riz

        K 1 Reply Last reply
        0
        • R Rajiya

          ya...i knw that i have to compare the ActualStartDate with DateTime.MinValue But how exactly to do it in the stored procedure? Let me knw if u have got any solution. Thanks, riz

          K Offline
          K Offline
          kguinn
          wrote on last edited by
          #4

          I am in the same boat on a project. It is said to be "bad design" to allow nulls and you should avoid doing so at all cost. Visual Basic shows the actual dates in the database so I have many fields with the date 12/31/9999 11:59:59 PM which is the max date. It seems that if something is such bad practice they would accommodate it better than they do. I will be watching this topic for answers, also if I find an answer I will be sure to post it here.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups