You need to sign in to do that
Don't have an account?
Null Date/Time Custom Field
Hi,
We've added a Date/Time custom field on our Lead object in Sales Force.
When I download the Leads to a datatable in in VS.NET, using our Enterprise WSDL, the null dates in this column have been converted to, and display as, "1/1/0001 12:00:00 AM"
The .NET datatable coulmn is define as :
<xs:element name="Date__c" msdataCaption="Date" type="xs:dateTime" minOccurs="0" />
The WSDL column is define as :
<s:element minOccurs="0" name="Date__c" nillable="true" type="s:dateTime" />
I could loop the datatable records and set the column to null where it equals "1/1/0001 12:00:00 AM", but it would be nice not to have to remember to do that if we add other custom date/time fields.
Any ideas?
Cheers
Nick
I've been looking at this problem (I forgot to say I'm displaying the data in an ASP.NET datalist)
If I loop the records and set the column to null where it equals "1/1/0001 12:00:00 AM", it STILL displays as "1/1/0001 12:00:00 AM".
It seems that this is an issue with the datalist control/.NET datasets.
The only solution I can find is to set the .NET datatable column type to string, loop the records and set the column to null where it equals "1/1/0001 12:00:00 AM".
This solves the problem, but I don't think the column would now sort very well.
Any other suggestion still welcome!
Message Edited by Nick @ AKCSL on 09-09-2004 03:03 AM
This is the code I was running to null the column:
foreach (dsChannelLeads.LeadRow lr in m_dsChannel.Lead.Rows)
{
if (lr.Date__c == Convert.ToDateTime("1/1/0001"))
lr.Date__c = Convert.ToDateTime(null);
}
m_dsChannel.AcceptChanges();
And, as you say, the convertion of null to datetime, doesn't return a null, it returns "1/1/0001 12:00:00 AM".
Looks like I'm stuck with the string option!