Date time storing null values
-
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
-
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
Compare ActualStartDate with DateTime.MinValue. if its same treat as null or empty...
M Aamir Maniar aamirOnline.com
-
Compare ActualStartDate with DateTime.MinValue. if its same treat as null or empty...
M Aamir Maniar aamirOnline.com
-
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
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.