dotConnect for DB2 Documentation
Devart.Common Namespace / DbDataTable Class / UpdatingFields Property
Example

In This Topic
    UpdatingFields Property (DbDataTable)
    In This Topic
    Gets or sets string containing list of field names used to generate update commands.
    Syntax
    'Declaration
     
    Public Property UpdatingFields As String
    public string UpdatingFields {get; set;}

    Property Value

    The string containing list of field names separated by semicolon.
    Example
    The following example demonstrates how to use the UpdatingFields property.
    static void UseDataTable(DbDataTable myDataTable, DbConnection myConnection) {
    
      myDataTable.Connection = myConnection;
      myDataTable.SelectCommand = myConnection.CreateCommand();
      myDataTable.SelectCommand.CommandText = "SELECT e.EMPNO, e.ENAME, e.JOB, d.DNAME 
            FROM Dept d, Emp e 
            where d.Deptno = e.Deptno";
    
      myDataTable.FetchAll = true;
      myDataTable.CachedUpdates = false;
      myDataTable.UpdatingTable = "Emp";
      myDataTable.UpdatingKeyFields = "EMPNO";
      myDataTable.UpdatingFields = "EMPNO;ENAME;JOB";
    
      myDataTable.Open();
    
      DataRow row = myDataTable.Rows[0];
      row[myDataTable.Columns["ENAME"]] = "John Smith";
    
      myDataTable.Update();
      myDataTable.Close();
    }
    Private Shared Sub UseDataTable(ByVal myDataTable As DbDataTable, ByVal myConnection As DbConnection)
      myDataTable.Connection = myConnection
      myDataTable.SelectCommand = myConnection.CreateCommand
      myDataTable.SelectCommand.CommandText = "SELECT e.EMPNO, e.ENAME, e.JOB, d.DNAME" + _ 
            "FROM Dept d, Emp e " + _
            "where d.Deptno = e.Deptno"
      myDataTable.FetchAll = True
      myDataTable.CachedUpdates = False
      myDataTable.UpdatingTable = "Emp"
      myDataTable.UpdatingKeyFields = "EMPNO"
      myDataTable.UpdatingFields = "EMPNO;ENAME;JOB"
      myDataTable.Open()
      Dim row1 As DataRow = myDataTable.Rows.Item(0)
      row1.Item(myDataTable.Columns.Item("ENAME")) = "John Smith"
      myDataTable.Update()
      myDataTable.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