DataConnector offers everything from wide range of data connection techniques using ADO.NET provider for Salesforce. This documentation helps you get started with C1.DataConnector control which gives an idea about different ways of data connection and operations with Salesforce.
This quick start will guide you through the steps of using DataConnector in a console application. Complete the steps given below to see how DataConnector works.
Follow the steps provided below to learn and implement data retrieval using ADO.NET provider for Salesforce.
C# |
Copy Code
|
---|---|
const string GCSalesforceServerConnectionString = @"Username=*********;Password=*********;Security Token=***********; OAuth Client Id=**************; OAuth Client Secret=*************; OAuth Token Endpoint=https://ap16.salesforce.com/services/oauth2/token; Url=https://ap16.salesforce.com/services/data/v45.0"; |
C# |
Copy Code
|
---|---|
String sql = "SELECT Id,BillingCity,BillingState from [Order] limit 10"; using (C1SalesforceConnection c = new C1SalesforceConnection($@"{GCSalesforceServerConnectionString}")) { //Open Connection c.Open(); using (C1SalesforceDataAdapter a = new C1SalesforceDataAdapter(c, sql)) { //Filling Data Table with the help of adapter DataTable t = new DataTable(); a.Fill(t); //Printing the fetched table data on console foreach (DataRow dataRow in t.Rows) { foreach (var item in dataRow.ItemArray) { Console.Write(item + " - "); } Console.WriteLine(); } } } |