dotConnect for Salesforce Documentation
Devart.Data.Salesforce Namespace / SalesforceLoader Class / Connection Property
Example

In This Topic
    Connection Property (SalesforceLoader)
    In This Topic
    Gets or sets the SalesforceConnection used by this instance of the SalesforceLoader.
    Syntax
    'Declaration
     
    Public Shadows Property Connection As SalesforceConnection
    public new SalesforceConnection Connection {get; set;}

    Property Value

    The connection to a data source. The default value is a null reference.
    Remarks
    SalesforceLoader instance uses SalesforceConnection during loading and for populating columns collection when CreateColumns method is called. For these operations SalesforceLoader requires open connection.

    This property supports the InterForm technology.

    Example
    The following example creates a SalesforceLoader, then populates Columns collection from table description, loads data, flushes the buffer, and disposes internal SalesforceLoader structures. The SalesforceLoader requires an open connection.
    public void LoadData(SalesforceConnection myConnection)
    {
            myConnection.Open();
            SalesforceLoader loader = new SalesforceLoader();
            loader.Connection = myConnection;
            loader.TableName = "Account";
            try
            {
                    loader.CreateColumns();
                    loader.Open();
                    for (int i = 1; i <= 10000; i++)
                    {
                            loader.SetValue("Name", "Test account" + i.ToString());
                            loader.SetValue("Type", "Customer - Direct");
                            loader.NextRow();
                    }
                    loader.Close();
            }
            finally
            {
                    myConnection.Close();
            }
    }
    Public Sub LoadData(ByVal myConnection As SalesforceConnection)
            myConnection.Open()
            Dim loader As SalesforceLoader
            loader = New SalesforceLoader
            loader.Connection = myConnection
            loader.TableName = "Account"
            Try
                    loader.CreateColumns()
                    loader.Open()
                    Dim i As Integer
                    For i = 1 To 10000
                            loader.SetValue("Name", "Test account" & i.ToString())
                            loader.SetValue("Type", "Customer - Direct")
                            loader.NextRow()
                    Next i
                    loader.Close()
            Finally
                    myConnection.Close()
            End Try
    End Sub
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also