Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


I am inserting Date as 1/1/1900 into Oracle database if that specific field is empty, as Oracle doesn't accept null values for the date.But while retrieving the same to grid view i want to show the field with date as 1/1/1900 as empty or ""
Could you please suggest me the way to archive this.



Thx in adv
Posted

You can replace this in your query also .

SQL
SELECT CASE DateValue WHEN '1/1/1900' THEN '' ELSE DateValue END 
FROM table Where Condition =Conditiaonvalue
 
Share this answer
 
v2
Comments
Tarun.K.S 21-Apr-11 8:41am    
Rahul, wrap your code in <pre> tags.
Harsha 2 21-Apr-11 9:47am    
Thnx Rahul,
I solved it with your solution.
RDBurmon 21-Apr-11 8:56am    
Thanks Tarun , I will take care from now onwards.
If this is a Windows Forms app and it is a DataGridView then handle the CellFormatting[^] event. Replace any occurrences of 1/1/1900 with an empty string.
 
Share this answer
 
Comments
Harsha 2 21-Apr-11 8:35am    
Hi
tnx for the reply,
i am using doing this in Web application not windows. Is it the same can be done in web also?
Henry Minute 21-Apr-11 8:51am    
See Rahul's reply, as this would be a good solution. You might also be able to use the RowDataBound event example -> http://msdn.microsoft.com/en-us/library/aa479342.aspx (scroll down to the last code example) where the background is set to yellow you could replace the content.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900