function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chris987654321Chris987654321 

Trouble updating Date field in C#

I am unable to update a Date field in Salesforce via C#.

 

I read the post here: http://community.salesforce.com/sforce/board/message?board.id=NET_development&thread.id=4069. I attempted to install the patch (NDP20-KB925272-X86.exe) but received a message saying that the program to be updated does not exist on my computer. I have C# Express, not the full version. Perhaps that is the problem?

 

I have also tried editing the WSDL by remarking out the xsd:date and changing all fields which are date to DateTime in the WSDL.  

 

Perhaps I am not coding it properly. This is what I have tried so far:

 

string LDA_Date = parsedCSVData[(i * NUM_COLUMNS) + 8]; DateTime dt = System.DateTime.Parse(LDA_Date); String dt2 = dt.ToUniversalTime().ToString("M-d-yyyy"); Log.Text += dt2.ToString() + "\n"; DateTime dt3 = Convert.ToDateTime(dt2); LDARecs[i].LDA__c = dt3;

 

I have also tried formatting it using "yyyy-MM-dd"  and "MM-dd-yyyy"

 

I have been able to update string fields. LDA__c is a Date (not DateTime) field in Salesforce.

 

 Thanks for any help that could be provided,

Chris 

 

Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell
you're probably missing a LDARecs[i].LDA__cSpecified = true; see the sticky at the top of the forum.

All Answers

Chris987654321Chris987654321
By the way, I have tried this on a Win XP machine and a Windows 7 machine.
SuperfellSuperfell
you're probably missing a LDARecs[i].LDA__cSpecified = true; see the sticky at the top of the forum.
This was selected as the best answer
Chris987654321Chris987654321
Thank you so much. That was it!