System.Data.Common Namespace DbDataAdapter Class
Loads a DataTable to the specified DataSet and configures the schema of the table based on the specified SchemaType and the given source table.
[ VB ]
Overrides Overloads Public Function FillSchema ( _
ByVal dataSet As DataSet, _
ByVal schemaType As SchemaType, _
ByVal srcTable As String
) As DataTable ( )
[ C# ]
public DataTable [ ] FillSchema (
DataTable dataTable,
SchemaType schemaType,
string srcTable
);
[ C++ ]
public: DataTable* FillSchema (
DataTable* dataTable,
SchemaType schemaType,
String* srcTable
) [ ];
[ JScript ]
public function FillSchema (
dataTable : DataTable,
schemaType : SchemaType,
srcTable : String
) : DataTable [ ];
- dataSet
- The DataSet to be filled with the schema from the data source.
- schemaType
- One of the SchemaType values.
- srcTable
- The name of the source table to use for table mapping.
A reference to a collection of DataTable objects that were added to the DataSet.
Exception Type |
Condition |
ArgumentException |
Occurs when the given source table from which to get the schema could not be found. |
This version of the FillSchema method adds a DataTable to a given DataSet object, and configures the table structure or schema based on the given SchemaType and the name of the source table.
When using FillSchema, the associated connection object need not be open. If the connection is closed before FillSchema is called, it is opened to retrieve data, then closed. If the connection is open before FillSchema is called, it remains open.
FillSchema also configures the PrimaryKey and Constraints properties of the specified table, if they exist at the data source.
FillSchema does not return any rows. To add rows to the DataTable, use the Fill method instead.
For more information, see Using the FillSchema Method.
The following example shows using FillSchema to retrieve the schema information of a DataSet using this constructor.
void FillSchemaDemo ( ( ) {
// . . . code to initialize DataAdapter and DataSet here . . .
DataTable [ ] myTableArray = myDataAdapter.FillSchema (
myDataSet, SchemaType.Mapped, "Products" );
}
Public Sub FillSchemaDemo ( ( )
' . . . code to initialize DataAdapter and DataSet here . . .
Dim myTableArray As DataTable ( ) = myDataAdapter.FillSchema ( _
myDataSet, SchemaType.Mapped, "Products" )
End Sub |
|
C# |
VB |
DbDataAdapter Members Fill DbDataAdapter.FillSchema Overload List