Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid, Datetime, Null Values 1

Status
Not open for further replies.

Compkitty

Programmer
Jan 7, 2005
121
US
I have a datagrid w/ datestimes, some of which are null... Is there a way that I can have it so when I load/update/delete that the null values appear null and not w/ 1/1/1900???
 
you could format it within your returned query

Code:
case when convert(char(10),datetimefield,101) is null then '' else convert(char(10),datetimefield,101) end

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Ok, I'm using Stored Procedures, any help w. that?? or an example ..

Ie.

Code:
Select Date1, Date2, Date3
From Table1
Where id = @id....

THANKS
 
Code:
Select case when convert(char(10),Date1,101) is null then '' else convert(char(10),Date1,101) end as Date1,
case when convert(char(10),Date2,101) is null then '' else convert(char(10),Date2,101) end as Date2,
case when convert(char(10),Date3,101) is null then '' else convert(char(10),Date3,101) end as Date3
from Table1
where id = @id

make sense?

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
It makes complete sense however, I'm getting an error; I'm guessing it's my syntax,... so let me play w/ it a moment.. THANKS for ur help
 
what type of error?

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top