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
natemanleynatemanley 

Getting Errors from .NET Data Provider

I am using the latest version of the .net data provider and I have some code that does something similar to the following this is just an example, I actually have a ton of fields in my insert statement so this is just here for the concept.

SforceCommand cmd = new SforceCommand("INSERT INTO LEAD (Email, FirstName, LastName, Company, Status) VALUES (@Email, @FirstName, @LastName, @Company, @Status)");

cmd.Parameters["@Email"].Value = " myemail@company.com ";
cmd.Parameters["@FirstName"].Value = "first";
cmd.Parameters["@LastName"].Value = "last";
cmd.Parameters["@Company"].Value = "Company Name";
cmd.Parameters["@Status"].Value = "New";

int i = cmd.ExecuteNonQuery();

After the ExecuteNonQuery is done i = 0 - so I know nothing happened.  Also, I don't get any results in Salesforce.  However, it doesn't throw any exceptions at all.  So where do I go to look for the SOAP messages that might have some meaningful descriptions of the error that occurred?

DevAngelDevAngel

Hi nate,

The provider does not currently support proxy settings (although it would not be that hard to implement).  The other issue is that error handling is pretty much removed.  I would open up the command object and either put a break point at the place where the actual sforce call is made, or change the catch to let the error bubble up.