dotConnect for SugarCRM Documentation
Devart.Data.Sugar Namespace / SugarLoader Class / SugarLoader Constructor / SugarLoader Constructor(String,SugarConnection)
Name of the table that will be loaded.
A SugarConnection object that represents the connection to a data source.
Example

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

    Parameters

    tableName
    Name of the table that will be loaded.
    connection
    A SugarConnection 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 SugarLoader and sets some of its properties. Then prepares data and loads it into the table.
    public void CreateMyLoader()
    {
      // Create and open connection
      SugarConnection conn = new SugarConnection(
          "server=https://your_company.sugaropencloud.eu;user id=admin;password=AmFFA4ZryM;");
      conn.Open();
    
      // Create loader instance
      SugarLoader loader = new SugarLoader("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 SugarConnection = new SugarConnection( _
          "server=https://your_company.sugaropencloud.eu;user id=admin;password=AmFFA4ZryM;")
      conn.Open()
    
      ' Create loader instance
      Dim loader As SugarLoader = new SugarLoader("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
    See Also

    Reference

    SugarLoader Class
    SugarLoader Members
    Overload List
    Devart.Data.Sugar.SugarLoaderColumn
    Devart.Data.Sugar.SugarLoaderColumnCollection