Data Access has been discontinued. Please refer to this page for more information.

MetaColumn

The MetaColumn class represents a column in a table in the underlying database. MetaColumn elements are children of MetaTable elements. Via the MetaColumn class you could take access to the following information:

  • SqlType - the type of data stored in the column.
  • IsNullable - indicates whether the corresponding column can have a null value.
  • Length - the maximum number of digits used to represent the column contents.
  • Scale - the scale of the column.
  • Table - the parent table that is associated with the current column.
  • IsPrimaryKey - indicates whether the column is part of the table's primary key.
  • IsBackendCalculated - indicates whether the corresponding column value is calculated on the server.
  • AdoType - the Ado data type for the current column. It is used for internal type mapping.
  • IsBackendVersion - indicates whether the column is a backend-specific version column.
  • HasDefaultValue - indicates whether the corresponding column has a default value on the server.

The following example explores the columns for each one of the tables from the metadata model:

private string GetColumns(Telerik.OpenAccess.Metadata.MetadataContainer container)
{
   StringBuilder sb = new StringBuilder();
   foreach (MetaTable table in container.Tables)
   {
       sb.AppendFormat("\nTable: {0}", table.Name);
       foreach (MetaColumn column in table.Columns)
       {
           sb.AppendFormat("\n****Column: {0}, IsPrimaryKey: {1}, SqlType: {2}",
               column.Name, column.IsPrimaryKey, column.SqlType);
       }
   }
   return sb.ToString();
}
Private Function GetColumns(ByVal container As Telerik.OpenAccess.Metadata.MetadataContainer) _
    As String
 Dim sb As New StringBuilder()
 For Each table As MetaTable In container.Tables
  sb.AppendFormat(vbLf & "Table: {0}", table.Name)
  For Each column As MetaColumn In table.Columns
   sb.AppendFormat(vbLf & "****Column: {0}, IsPrimaryKey: {1}, SqlType: {2}",
       column.Name, column.IsPrimaryKey, column.SqlType)
  Next column
 Next table
 Return sb.ToString()
End Function