Page 1 of 1

Help with Inserting data via dotConnect to SalesForce..

Posted: Tue 27 Aug 2013 20:52
by SAMORAN24
I am attempting to perform an INSERT INTO the Task table and I get the following error code: -2147467259 with the message "Execute Command Failed" with no other information. Can you help me. Thank you.

This is the INSERT Statement that I am trying to submit:

string mySelectQuery = "INSERT INTO TASK (WhoId, WhatId, Subject, ActivityDate, Status, OwnerId, Description, ReminderDateTime, IsReminderSet,
Next_Steps, Priority) VALUES ('0018000000hSCaf', '0068000000lTVD1AAO', 'Call - Outbound',
'8/28/2013 3:45:33 PM', 'Not Started', '00580000003K3EpAAK',
'test', '8/27/2013 3:45:34 PM', True,
'my test', 'Normal')"

string myConnString = "My Login String";
SalesforceConnection salesforceConnection = new SalesforceConnection(myConnString);
salesforceConnection.Open();
SalesforceCommand salesforceCommand = new SalesforceCommand(mySelectQuery, salesforceConnection);

salesforceCommand.ExecuteNonQuery();
salesforceConnection.Close();

Re: Help with Inserting data via dotConnect to SalesForce..

Posted: Fri 30 Aug 2013 14:36
by Shalex
Please process the generated SalesforceException in the following way:

Code: Select all

      try {
        //...
      }
      catch (SalesforceException ex) {
        foreach (SalesforceError error in ex.Errors)
          Console.WriteLine(error.Message);
      }
If this doesn't help, tell us your output of the catch block.

In case of Entity Framework, the reason of the problem can be found in this way:

Code: Select all

      try {
        //...
      }
      catch (UpdateException ex) {
        SalesforceException inner = ex.InnerException as SalesforceException;
        if (inner != null)
          foreach (SalesforceError error in inner.Errors)
            Console.WriteLine(error.Message);
      }

Re: Help with Inserting data via dotConnect to SalesForce..

Posted: Fri 30 Aug 2013 15:38
by SAMORAN24
Thank you very much for the help.