KeyFields don't work for SalesForce

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
PascalD2
Posts: 9
Joined: Wed 12 Jan 2011 03:48

KeyFields don't work for SalesForce

Post by PascalD2 » Wed 13 Apr 2016 14:23

Hi,

I am trying to use the SalesforceCommandBuilder to generate an update sql for the account table and it gives me an exception when I try it with the default options (WHERE clause of the UPDATE statement can't be transformed to SOQL) . So I tried to set the KeyFields property without success... It is still adding more fields than expected...

WHERE clause generated:

Code: Select all

WHERE ((Id = :p6) AND ((:p7 = 1 AND No_d_etablissement_ZACK IS NULL) OR (No_d_etablissement_ZACK = :p8)) AND ((:p9 = 1 AND No_d_agence_ZACK IS NULL) OR (No_d_agence_ZACK = :p10)))
C# Code:

Code: Select all

 cmdBuilder.UpdatingTable = "Account";
                    cmdBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    cmdBuilder.KeyFields = "Id";
                    cmdBuilder.SetAllValues = false;
                    string[] fields = {"Mot_de_passe", "Date_mot_de_passe", "ID_machine", "Mot_de_passe_machine", "Date_mot_de_passe_machine" };
                    adapter.UpdateCommand = cmdBuilder.GetUpdateCommand(fields, false);
                    adapter.UpdateCommand.Connection = sfConnection;
                    adapter.Update(accountsTable);

1- I am not sure why it can't transform this WHERE clause to SOQL...
2- Why does the command builder doesn't use only the Id to generate the WHERE clause as specified by the KeyFields option

NOTE: If I set KeyFields to "Id, Name" it is adding Id, Name and the 2 other columns to the WHERE clause !

Thanks

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

Re: KeyFields don't work for SalesForce

Post by Shalex » Mon 18 Apr 2016 12:25

Thank you for your report. We have reproduced the issue and are investigating it. We will notify you about the result.

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

Re: KeyFields don't work for SalesForce

Post by Shalex » Fri 09 Dec 2016 18:49

The bug with using SalesforceCommandBuilder.KeyFields in the generated update command is fixed: https://www.devart.com/dotconnect/sales ... story.html.

Post Reply