dotConnect for Dynamics 365 Documentation
Devart.Data.Dynamics Namespace / DynamicsLoader Class / DynamicsLoader Constructor / DynamicsLoader Constructor(String,DynamicsConnection)
Name of the table that will be loaded.
A DynamicsConnection object that represents the connection to a data source.
Example

In This Topic
    DynamicsLoader Constructor(String,DynamicsConnection)
    In This Topic
    Initializes a new instance of the DynamicsLoader class with table name that will be loaded and a DynamicsConnection object.
    Syntax
    'Declaration
     
    Public Function New( _
       ByVal tableName As String, _
       ByVal connection As DynamicsConnection _
    )
    public DynamicsLoader( 
       string tableName,
       DynamicsConnection connection
    )

    Parameters

    tableName
    Name of the table that will be loaded.
    connection
    A DynamicsConnection object that represents the connection to a data source.
    Remarks
    Use this constructor to set TableName and Connection properties at the time of initialization.
    Example
    The following example creates a DynamicsLoader and sets some of its properties. Then prepares data and loads it into the table.
    public void CreateMyLoader()
    {
      // Create and open connection
      DynamicsConnection conn = new DynamicsConnection(
          "Server=https://your_company.crm4.dynamics.com;User [email protected];Password=A123456789;");
      conn.Open();
    
      // Create loader instance
      DynamicsLoader loader = new DynamicsLoader("loader_test", conn);
         
      // Prepare for loading
      loader.Open();
    
      // Set row values
      for (int i = 0; i < 10000; i++) {
        loader.SetValue(0, i);
        loader.SetValue(1, "test string");
        loader.SetValue(2, DateTime.Now);
        // Load next table row
        loader.NextRow();
      }
    
      // Flush buffer and finish loading
      loader.Close();
    }
    Public Sub CreateMyLoader()
      ' Create and open connection
      Dim conn As DynamicsConnection = new DynamicsConnection( _
          "Server=https://your_company.crm4.dynamics.com;User [email protected];Password=A123456789;")
      conn.Open()
    
      ' Create loader instance
      Dim loader As DynamicsLoader = new DynamicsLoader("loader_test", conn)
         
      ' Prepare for loading
      loader.Open()
    
      ' Set row values
      Dim i As Integer
      For i = 0 To 10000
        loader.SetValue(0, i)
        loader.SetValue(1, "test string")
        loader.SetValue(2, DateTime.Now)
        ' Load next table row
        loader.NextRow()
      next
    
      ' Flush buffer and finish loading
      loader.Close()
    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

    Reference

    DynamicsLoader Class
    DynamicsLoader Members
    Overload List
    Devart.Data.Dynamics.DynamicsLoaderColumn
    Devart.Data.Dynamics.DynamicsLoaderColumnCollection