Question : How do I convert the SQL default date value of '#12/30/1899#' to an empty string?  I want to bind the select (in a datareader) to a datagrid, and I do not want the bogus date to display

I need to bind a datareader to a datagrid and some columns are dates.  Since they can have #12/30/1899# as the empty value, I want those converted to an empty string so nothing is displayed in the bound datagrid.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
SELECT CONVERT(CHAR(10), ScheduledLabDate, 103) AS Scheduled,
ScheduledLabTestingCompleted AS ScheduledCompleted,
CASE WHEN UnscheduledLabDate = '#12/30/1899#' THEN ''
ELSE CONVERT(CHAR(10), UnscheduledLabDate, 103) AS Unscheduled,
UnscheduledLabTestingCompleted AS UnscheduledCompleted
FROM CTMS_ClinicalSafetyLabTrackingDetails (NOLOCK) 
WHERE ProtocolID = 'ABC-001-Inhalation.001'
AND SiteNumber = '125'
AND SubjectNumber = 'P125-0001'
Open in New Window Select All

Answer : How do I convert the SQL default date value of '#12/30/1899#' to an empty string?  I want to bind the select (in a datareader) to a datagrid, and I do not want the bogus date to display

Let me know if this helps....
1:
2:
3:
4:
5:
6:
7:
8:
9:
SELECT CONVERT(CHAR(10), ScheduledLabDate, 103) AS Scheduled,
ScheduledLabTestingCompleted AS ScheduledCompleted,
CASE WHEN ISNULL(UnscheduledLabDate,'12/30/1899') = '12/30/1899' THEN ''
ELSE CONVERT(CHAR(10), UnscheduledLabDate, 103) END AS Unscheduled,
UnscheduledLabTestingCompleted AS UnscheduledCompleted
FROM CTMS_ClinicalSafetyLabTrackingDetails (NOLOCK) 
WHERE ProtocolID = 'ABC-001-Inhalation.001'
AND SiteNumber = '125'
AND SubjectNumber = 'P125-0001'
Open in New Window Select All
Random Solutions  
 
programming4us programming4us