dotConnect for DB2 Documentation
Devart.Data.DB2 Namespace / DB2LoaderColumn Class
Members Example

In This Topic
    DB2LoaderColumn Class
    In This Topic
    Represents the attributes for column loading.
    Syntax
    'Declaration
     
    Public Class DB2LoaderColumn 
       Inherits Devart.Common.DbLoaderColumn
    public class DB2LoaderColumn : Devart.Common.DbLoaderColumn 
    Remarks

    Each DB2Loader uses a DB2Loader.Columns to maintain a collection of DB2LoaderColumn objects. The DB2LoaderColumn object represents the attributes for column loading. Every DB2LoaderColumn object corresponds to one of the table fields with the same name as its Name property.

    You can manually make changes to the DB2Loader.Columns collection to exclude some columns from INSERT statement generated by DB2Loader object.

    Example
    This sample shows how to perform loading of data into a table with the last column set to default value.
    public void LoadData(DB2Connection db2Connection)
    {
      db2Connection.Open();
      DB2Loader loader = new DB2Loader();
      loader.Connection = db2Connection;
      loader.TableName = "load_table";
      try
      {
        loader.CreateColumns();
        //Do not insert data in the last column
        loader.Columns.RemoveAt(loader.Columns.Count-1);
        loader.Open();
        for (int i = 1; i <= 100; i++)
        {
          loader.SetValue("id", i);
          loader.SetValue(1, "test string");
          loader.SetValue("date_field", DateTime.Now);
          loader.NextRow();
        }
        loader.Close();
      }
      finally
      {
        db2Connection.Close();
      }
    }
    Public Sub LoadData(ByVal db2Connection As DB2Connection)
      db2Connection.Open()
      Dim loader As DB2Loader
      loader = New DB2Loader
      loader.Connection = db2Connection
      loader.TableName = "load_table"
      Try
        loader.CreateColumns()
        ' Do not insert data in the last column
        loader.Columns.RemoveAt(loader.Columns.Count - 1)
        loader.Open()
        Dim i As Integer
        For i = 1 To 100
          loader.SetValue("id", i)
          loader.SetValue(1, "test string")
          loader.SetValue("date_field", DateTime.Now)
          loader.NextRow()
        Next i
        loader.Close()
      Finally
        db2Connection.Close()
      End Try
    End Sub
    Inheritance Hierarchy

    System.Object
       System.MarshalByRefObject
          Devart.Common.DbLoaderColumn
             Devart.Data.DB2.DB2LoaderColumn

    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