System.Data [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00] 1.0.3300.0 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.ComponentModel.MarshalByValueComponent System.ComponentModel.DesignTimeVisible(false) System.ComponentModel.DefaultProperty("ColumnName") System.ComponentModel.ToolboxItem(false) System.ComponentModel.Editor("Microsoft.VSDesigner.Data.Design.DataColumnEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")

The is the fundamental building block for creating the schema of a . You build the schema by adding one or more objects to the . For more information, see Adding Columns to a Table.

Each has a property that determines the kind of data the contains. For example, you can restrict the data type to integers, or strings, or decimals. Because data that is contained by the is typically merged back into its original data source, you must match the data types to those in the data source. For more information, see Mapping .NET Framework Data Provider Data Types to .NET Framework Data Types.

Properties such as , , and put restrictions on the entry and updating of data, thereby helping to guarantee data integrity. You can also use the , , and properties to control automatic data generation. For more information about columns, see Creating AutoIncrement Columns. For more information, see Defining a Primary Key for a Table.

You can also make sure that values in a are unique by creating a and adding it to the of the to which the belongs. For more information, see Adding Constraints to a Table.

To create a relation between objects, create a object and add it to the of a .

You can use the property of the object to calculate the values in a column, or create an aggregate column. For more information, see Creating Expression Columns.

Represents the schema of a column in a .

- Constructor

  When created, a object has no default or . When you add it to a , a default name ("Column1", "Column2", and so on) will be generated if a name has not been assigned to the .

  Initializes a new instance of a class as type string.

  1.0.5000.0
  2.0.0.0
- Constructor

  By default, the name specific to a column becomes the property value.

  Initializes a new instance of the class, as type string, using the specified column name.

  A string that represents the name of the column to be created. If set to null or an empty string (""), a default name will be specified when added to the columns collection.
  1.0.5000.0
  2.0.0.0
- Constructor
  To be added

  Initializes a new instance of the class using the specified column name and data type.

  A string that represents the name of the column to be created. If set to null or an empty string (""), a default name will be specified when added to the columns collection.
  A supported .
  1.0.5000.0
  2.0.0.0
- Constructor
  To be added

  Initializes a new instance of the class using the specified name, data type, and expression.

  A string that represents the name of the column to be created. If set to null or an empty string (""), a default name will be specified when added to the columns collection.
  A supported .
  The expression used to create this column. For more information, see the property.
  1.0.5000.0
  2.0.0.0
- Constructor

  The argument sets the property. The property specifies how a is mapped when a is transformed into an XML document. For example, if the column is named "fName," and the value it contains is "Bob," and is set to MappingType.Attribute, the XML element would be as follows:

  <Name fName = 'Bob'/>

  For more information about how columns are mapped to elements or attributes, see the property.

  Initializes a new instance of the class using the specified name, data type, expression, and value that determines whether the column is an attribute.

  A string that represents the name of the column to be created. If set to null or an empty string (""), a default name will be specified when added to the columns collection.
  A supported .
  The expression used to create this column. For more information, see the property.
  One of the values.
  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean To be added: an object of type 'bool' To be added

  Gets or sets a value that indicates whether null values are allowed in this column for rows that belong to the table.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(true)
- Property
  System.Boolean To be added: an object of type 'bool'

  If the type of this column is not Int16, Int32, or Int64 when this property is set, the property is coerced to Int32. An exception is generated if this is a computed column. The property is set. The incremented value is used only if the row's value for this column, when added to the columns collection, is equal to the default value.

  You can create a new row using the property of the class and passing in an array of values. This is a potential problem for a column with its set to true, because its value is generated automatically. To use the property, place null in the column's position in the array. For more information, see the property of the class.

  If the type of the column is or , will not work. Use Int16 or Int32 instead.

  If the type of the column is or , will only partially work. Use Int64 or Decimal instead.

  When the value is added to the current value, the overflow check is suppressed.

  Gets or sets a value that indicates whether the column automatically increments the value of the column for new rows added to the table.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.All)
  System.ComponentModel.DefaultValue(false)
- Property
  System.Int64 To be added: an object of type 'long' To be added

  Gets or sets the starting value for a column that has its property set to true. The default is 0.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(0)
- Property
  System.Int64 To be added: an object of type 'long' To be added

  Gets or sets the increment used by a column with its property set to true.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(1)
- Property
  System.String To be added: an object of type 'string'

  You can use the property to display a descriptive or friendly name for a .

  Gets or sets the caption for the column.

  1.0.5000.0
  2.0.0.0
- Method
  1.0.5000.0
  2.0.0.0
  System.Void To be added.

  This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

- Method
  System.Void To be added

  This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

  1.0.5000.0
  2.0.0.0
- Property
  System.Data.MappingType To be added: an object of type 'MappingType'

  The property determines how a is mapped when a is saved as an XML document using the method.

  For example, if a is named "customerID," and its property is set to MappingType.Element, the column value will produce the following XML:

  `<Customers> <customerID>ALFKI</customerID> ...... </Customers> <Orders> <OrderID>12345</OrderID> <customerID>ALFKI</customerID> ...... </Orders>`

  However, if the same column is mapped to MappingType.Attribute, the following XML is produced:

  `<Customers customerID="ALFKI"........more attributes.....> <Order orderID="1234"....more attributes..../> <Order orderID="1234"....more attributes..../> ...... More orders for this customer </Customers>`

  Use the constructor that contains the argument to specificy how the is mapped when its is transformed to an XML document.

  The property corresponds to the constructor argument .

  Gets or sets the of the column.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(System.Data.MappingType.Element)
- Property
  System.String To be added: an object of type 'string'

  When a is created, it has no value. However, when the is added to a for a object, it is given a default name ("Column1", "Column2", and so on).

  By default, the value is set to the value.

  Gets or sets the name of the column in the .

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.All)
- Property
  System.Type To be added: an object of type 'Type'

  Setting the value is very important to guaranteeing the correct creation and updating of data in a data source.

  The property supports the following base .NET Framework data types:

  as well as the following array type:

  Byte[]

  An exception is generated when changing this property after the column has begun storing data.

  If is set to true before setting the property, and you try to set the type to anything except an integer type, an exception is generated.

  A column of data type Byte[] requires special treatment in certain cases since, unlike the base .NET Framework data types, it is a reference data type. If a column of data type Byte[] is used as a , or as a or key for a , any change to the column value must involve assigning the Byte[] column value to a separately instantiated Byte[] object. This assignment is required to trigger the update of the internal indexes used by sorting, filtering, and primary key operations. This is illustrated by the following example:

  `byte[] columnValue = (byte[])myDataTable.Rows[0][0]; byte[] newValue = (byte[])columnValue.Clone(); newValue[1] = 2; myDataTable.Rows[0][0] = newValue;`

  Although it is possible to define a column as data type other than the base .NET Framework data types and Byte[], such a column will be treated as a user-defined type, subject to the following usage restrictions. (For more information on user-defined types, see Creating and Using User-Defined Types.)

  The column cannot be part of a or expression.

  If the column is used as a , or as a or for a , it must be treated as an immutable field; the column data must not be changed once it has been added to the table.

  Its can be only set to MappingType.Element.

  The class that implements the column’s data type must be must be marked with the , and if necessary implement the or interface.

  Support for change tracking is limited. To utilize the class’s change tracking mechanism, the class that implements the column’s data type must either implement the interface, or take over the responsibility for informing the when the column value has been modified, either by calling on the row or by assigning the column value object to a separately instantiated column value object.

  Gets or sets the type of data stored in the column.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.TypeConverter(typeof(System.Data.ColumnTypeConverter))
  System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.All)
  System.ComponentModel.DefaultValue(typeof(System.String))
- Property
  2.0.0.0
  System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.All)
  System.ComponentModel.DefaultValue(System.Data.DataSetDateTime.UnspecifiedLocal)
  System.Data.DataSetDateTime To be added.

  The cannot be modified after rows are added to a , except for modifying from and or vice-versa. The modification from UnspecifiedLocal to Unspecified and vice-versa is allowed as the difference between these two options is only during serialization and does not affect the storage.

  Gets or sets the DateTimeMode for the column.

- Property
  System.Object To be added: an object of type 'object'

  A default value is the value that is automatically assigned to the column when a is created (for example, the date and time when the was created.

  When is set to true, there can be no default value.

  You can create a new row using the property of the class and passing the method an array of values. This is a potential problem for a column with a default value because its value is generated automatically. To use the property with such a column, place null in the column's position in the array. For more information, see the property.

  Gets or sets the default value for the column when you are creating new rows.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.TypeConverter(typeof(System.Data.DefaultValueTypeConverter))
- Property
  System.String To be added: an object of type 'string'

  One use of the property is to create calculated columns. For example, to calculate a tax value, the unit price is multiplied by a tax rate of a specific region. Because tax rates vary from region to region, it would be impossible to put a single tax rate in a column; instead, the value is calculated using the property, as shown in the Visual Basic code in the following section:

  DataSet1.Tables("Products").Columns("tax").Expression = "UnitPrice * 0.086"

  A second use is to create an aggregate column. Similar to a calculated value, an aggregate performs an operation based on the complete set of rows in the . A simple example is to count the number of rows returned in the set. This is the method you would use to count the number of transactions completed by a particular salesperson, as shown in this Visual Basic code:

  `DataSet1.Tables("Orders").Columns("OrderCount").Expression = "Count(OrderID)"`

  ## Expression Syntax

  When you create an expression, use the property to refer to columns. For example, if the for one column is "UnitPrice", and another "Quantity", the expression would be as follows:

  "UnitPrice * Quantity"

  If a column is used in an expression, then the expression is said to have a dependency on that column. If a dependent column is renamed or removed, no exception is thrown. An exception will be thrown when the now-broken expression column is accessed.

  When you create an expression for a filter, enclose strings with single quotation marks:

  "LastName = 'Jones'"

  If a column name contains any non-alphanumeric characters or starts with a digit or matches (case-insensitively) any of the following reserved words, it requires special handling, as described in the following paragraphs.

  And

  Between

  Child

  False

  In

  Is

  Like

  Not

  Null

  Or

  Parent

  True

  If a column name satisfies one of the above conditions, it must be wrapped in either square brackets or the "`" (grave accent) quotes. For example, to use a column named "Column#" in an expression, you would write either "[Column#]":

  Total * [Column#]

  or "`Column#`":

  Total * `Column#`

  If the column name is enclosed in square brackets then any ']' and '\' characters (but not any other characters) in it must be escaped by prepending them with the backslash ("\") character. If the column name is enclosed in grave accent characters then it must not contain any grave accent characters in it. For example, a column named "Column[]\" would be written:

  Total * [Column[\]\\]

  or

  Total * `Column[]\`

  ## User-Defined Values

  User-defined values may be used within expressions to be compared with column values. String values should be enclosed within single quotation marks (and each single quotation character in a string value has to be escaped by prepending it with another single quotation character). Date values should be enclosed within pound signs (#) or single quotes (') based on the data provider. Decimals and scientific notation are permissible for numeric values. For example:

  "FirstName = 'John'"

  "Price <= 50.00"

  "Birthdate < #1/31/82#"

  For columns that contain enumeration values, cast the value to an integer data type. For example:

  "EnumColumn = 5"

  ## Parsing Literal Expressions

  All literal expressions must be expressed in the invariant culture locale. When DataSet parses and converts literal expressions, it always uses the invariant culture, not the current culture.

  String literals are identified when there are single quotes surrounding the value. For example:

  'John'

  Boolean literals are true and false; they are not quoted in expressions.

  Integer literals [+-]?[0-9]+ are treated as System.Int32, System.Int64 or System.Double. System.Double can lose precision depending on how large the number is. For example, if the number in the literal is 2147483650, DataSet will first attempt to parse the number as an Int32. This will not succeed because the number is too large. In this case DataSet will parse the number as an Int64, which will succeed. If the literal was a number larger than the maximum value of an Int64, DataSet will parse the literal using Double.

  Real literals using scientific notation, such as 4.42372E-30, are parsed using System.Double.

  Real literals without scientific notation, but with a decimal point, are treated as System.Decimal. If the number exceeds the maximum or minimum values supported by System.Decimal, then it is parsed as a System.Double. For example:

  142526.144524 will be converted to a Decimal.

  345262.78036719560925667 will be treated as a Double.

  ## Operators

  Concatenation is allowed using Boolean AND, OR, and NOT operators. You can use parentheses to group clauses and force precedence. The AND operator has precedence over other operators. For example:

  (LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'

  When you create comparison expressions, the following operators are allowed:

  <

  >

  <=

  >=

  <>

  =

  IN

  LIKE

  The following arithmetic operators are also supported in expressions:

  + (addition)

  - (subtraction)

  * (multiplication)

  / (division)

  % (modulus)

  ## String Operators

  To concatenate a string, use the + character. The value of the property of the class determines whether string comparisons are case-sensitive. However, you can override that value with the property of the class.

  ## Wildcard Characters

  Both the * and % can be used interchangeably for wildcard characters in a LIKE comparison. If the string in a LIKE clause contains a * or %, those characters should be enclosed in brackets ([]). If a bracket is in the clause, each bracket character should be enclosed in brackets (for example [[] or []]). A wildcard is allowed at the start and end of a pattern, or at the end of a pattern, or at the start of a pattern. For example:

  "ItemName LIKE '*product*'"

  "ItemName LIKE '*product'"

  "ItemName LIKE 'product*'"

  Wildcard characters are not allowed in the middle of a string. For example, 'te*xt' is not allowed.

  ## Parent/Child Relation Referencing

  A parent table may be referenced in an expression by prepending the column name with Parent. For example, the Parent.Price references the parent table's column named Price.

  When a child has more than one parent row, use Parent(RelationName).ColumnName. For example, the Parent(RelationName).Price references the parent table’s column named Price via the relation.

  A column in a child table may be referenced in an expression by prepending the column name with Child. However, because child relationships may return multiple rows, you must include the reference to the child column in an aggregate function. For example, Sum(Child.Price) would return the sum of the column named Price in the child table.

  If a table has more than one child, the syntax is: Child(RelationName). For example, if a table has two child tables named Customers and Orders, and the object is named Customers2Orders, the reference would be as follows:

  Avg(Child(Customers2Orders).Quantity)

  ## Aggregates

  The following aggregate types are supported:

  Sum (Sum)

  Avg (Average)

  Min (Minimum)

  Max (Maximum)

  Count (Count)

  StDev (Statistical standard deviation)

  Var (Statistical variance).

  Aggregates are ordinarily performed along relationships. Create an aggregate expression by using one of the functions listed earlier and a child table column as detailed in Parent/Child Relation Referencing that was discussed earlier. For example:

  Avg(Child.Price)

  Avg(Child(Orders2Details).Price)

  An aggregate can also be performed on a single table. For example, to create a summary of figures in a column named "Price":

  Sum(Price)

  If you use a single table to create an aggregate, there would be no group-by functionality. Instead, all rows would display the same value in the column.

  If a table has no rows, the aggregate functions will return null.

  Data types can always be determined by examining the property of a column. You can also convert data types using the Convert function, shown in the following section.

  An aggregate can only be applied to a single column and no other expressions can be used inside the aggregate.

  ## Functions

  The following functions are also supported:

  CONVERT

  Description

  Converts particular expression to a specified .NET Framework Type.

  Syntax

  Convert(, )

  Arguments

  -- The expression to convert.

  -- The .NET Framework type to which the value will be converted.

  Example: myDataColumn.Expression="Convert(total, 'System.Int32')"

  All conversions are valid with the following exceptions: Boolean can be coerced to and from Byte, SByte, Int16, Int32, Int64, UInt16, UInt32, UInt64, String and itself only. Char can be coerced to and from Int32, UInt32, String, and itself only. DateTime can be coerced to and from String and itself only. TimeSpan can be coerced to and from String and itself only.

  LEN

  Description

  Gets the length of a string

  Syntax

  LEN()

  Arguments

  -- The string to be evaluated.

  Example: myDataColumn.Expression="Len(ItemName)"

  ISNULL

  Description

  Checks an expression and either returns the checked expression or a replacement value.

  Syntax

  ISNULL(, )

  Arguments

  -- The expression to check.

  -- If expression is null, is returned.

  Example: myDataColumn.Expression="IsNull(price, -1)"

  IIF

  Description

  Gets one of two values depending on the result of a logical expression.

  Syntax

  IIF(, , )

  Arguments

  -- The expression to evaluate.

  -- The value to return if the expression is true.

  -- The value to return if the expression is false.

  Example: myDataColumn.Expression = "IIF(total>1000, 'expensive', 'dear')

  TRIM

  Description

  Removes all leading and trailing blank characters like \r, \n, \t, ' '

  Syntax

  TRIM()

  Arguments

  -- The expression to trim.

  SUBSTRING

  Description

  Gets a sub-string of a specified length, starting at a specified point in the string.

  Syntax

  SUBSTRING(,,)

  Arguments

  -- The source string for the substring.

  -- Integer that specifies where the substring starts.

  -- Integer that specifies the length of the substring.

  Example: myDataColumn.Expression = "SUBSTRING(phone, 7, 8)"

  You can reset the property by assigning it a null value or empty string. If a default value is set on the expression column, all previously filled rows are assigned the default value after the property is reset.

  Gets or sets the expression used to filter rows, calculate the values in a column, or create an aggregate column.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.All)
  System.ComponentModel.DefaultValue("")
- Property
  System.Data.PropertyCollection To be added: an object of type 'PropertyCollection'

  The property lets you store custom information with the object. For example, you may store a time when the data should be refreshed.

  Extended properties must be of type . Properties that are not of type are not persisted when the is written as XML.

  Gets the collection of custom user information associated with a .

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.Browsable(false)
- Property
  System.Int32 To be added: an object of type 'int'

  The property is ignored for non-text columns. A exception is raised if you assign to a non-string column.

  Gets or sets the maximum length of a text column.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(-1)
- Property
  System.String To be added: an object of type 'string'

  The property is used when reading and writing an XML document into a in the using the , , , or methods.

  The namespace of an XML document is used to scope XML attributes and elements when read into a . For example, a contains a schema read from a document that has the namespace "myCompany," and an attempt is made to read data (with the method) from a document that has the namespace "theirCompany." Any data that does not correspond to the existing schema will be ignored.

  Gets or sets the namespace of the .

  1.0.5000.0
  2.0.0.0
- Method
  1.0.5000.0
  2.0.0.0
  System.Void `` To be added.

  This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

  Parameter reference.
- Property
  System.Int32 To be added: an object of type 'int' To be added

  Gets the (zero-based) position of the column in the collection.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
- Property
  System.String To be added: an object of type 'string'

  The is used throughout an XML document to identify elements which belong to the namespace for a object (as set by the property).

  Gets or sets an XML prefix that aliases the namespace of the .

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue("")
- Method
  1.0.5000.0
  2.0.0.0
  System.Void `` To be added.

  This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.

  Parameter reference.
- Property
  System.Boolean To be added: an object of type 'bool' To be added

  Gets or sets a value that indicates whether the column allows for changes as soon as a row has been added to the table.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DefaultValue(false)
- Method
  2.0.0.0
  System.Void ``

  Changes the ordinal or position of the to the specified ordinal or position. If ordinal is less than 0 or greater than the existing number of columns – 1 (greater than the ordinal of the last column) then an Invalid is thrown.

  When you change a column’s ordinal, the column is moved to the new position in the collection of columns. Any columns between the previous and new ordinal will be renumbered, to adjust for a column's new ordinal.

  Changes the ordinal or position of the to the specified ordinal or position.

  The specified ordinal.
- Property
  System.Data.DataTable To be added: an object of type 'DataTable' To be added

  Gets the to which the column belongs to.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.Browsable(false)
- Method
  System.String To be added

  Gets the of the column, if one exists.

  The value, if the property is set; otherwise, the property.

  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean To be added: an object of type 'bool'

  As soon as this property is changed from false to true, a unique constraint will be created on this column to make sure that values are unique.

  Gets or sets a value that indicates whether the values in each row of the column must be unique.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.ComponentModel.DefaultValue(false)