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
giribabu gedagiribabu geda 

Dataloading through .net application.

hi,
 
Help needed,
 
Requirmemts for datamigration from SQL server to Salesforce:
 
i had data in sql server database with 1 lac records.these contact records needs to be loaded  to salesforce using .net  application on button click  .
 
i developed the application and able to load the data on button click event.
 
the way in which i developed the application is onclick of a button i get all the records from salesforce and check each and every record with the record in my local database if the record exists i update the record in sales force else i create a new record.
 
this is the piece of code i use to compare the records:
 

/* Loop will compare PG suid matched with salesfoce suid*/

#region Loop will compare PG suid matched with salesfoce suid

for (i = 0; i < qr.size; i++)

{

contact = (Contact)records[i];

if (Convert.ToString(contact.SUID__c) != null)

{

if (contact.SUID__c.ToString() == str.ToString())

{

k = i;

j = 1;

strcurrentval = str.ToString();

string strcontactsuid = contact.SUID__c.ToString();

break;

}

}

else if(Convert.ToString(contact.Email) != null || Convert.ToString(contact.Email_2__c) != null )

{

if ((Convert.ToString(contact.Email) == prefemail.ToString() || Convert.ToString(contact.Email) == otheremail.ToString()) || (Convert.ToString(contact.Email_2__c) == otheremail.ToString() || Convert.ToString(contact.Email_2__c) == prefemail.ToString()))

{

k = i;

j = 1;

break;

}

}

}

#endregion

/*IF the suid of PG data matched with Salesforce data then it will update */

//dsContact.Tables[0].Columns.Add("Record Status");

if (Convert.ToString(qr.size) != "0" && j == 1)

{

here goes the update and create records to salesforce. 

}

 
the problem i face is severe performance issue.
 
 
please
 i need help on this issue.
 
Thanks in advance.
 

 
 
 
 
SuperfellSuperfell
Rather than fetching every row, can't you just construct a query that queries for rows with the same match Key that you're using (it appears your matching rows based on a combination of columns, rather than storing one systems PK in the other, which would be much better). If you could store the SQL Server PK in the salesforce table and mark that column as an externalId, you could simply just do an upsert call, no need to query at all.
giribabu gedagiribabu geda

hi simon,

Thanks for the reply.

i actually had SUID  as the key based on which i am uploading

but that suid is neither primary key nor unique key
 
but i know that it is maintained unique through out the table
 
so i am using that as the reference.
 
please do me a favour by sending a sample code on how to upsert by matching the key field.
 
Thanks
 
 
giribabu 
SuperfellSuperfell
Please read the API docs on the Upsert call, its all explained there.
http://www.salesforce.com/us/developer/docs/api/index.htm