Help with Inserting data via dotConnect to SalesForce..

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
SAMORAN24
Posts: 2
Joined: Tue 27 Aug 2013 20:45

Help with Inserting data via dotConnect to SalesForce..

Post by SAMORAN24 » Tue 27 Aug 2013 20:52

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();

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

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

Post by Shalex » Fri 30 Aug 2013 14:36

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);
      }

SAMORAN24
Posts: 2
Joined: Tue 27 Aug 2013 20:45

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

Post by SAMORAN24 » Fri 30 Aug 2013 15:38

Thank you very much for the help.

Post Reply