System.Data.Common Namespace DbDataAdapter Class
Loads a DataTable to the current DataSet and configures the schema of the table to match that in the data source based on the specified SchemaType.
[ VB ]
Overloads Public Function FillSchema ( _
ByVal dataTable As DataTable, _
ByVal schemaType As SchemaType _
) As DataTable
[ C# ]
public DataTable FillSchema (
DataTable dataTable,
SchemaType schemaType
);
[ C++ ]
public: DataTable* FillSchema (
DataTable* dataTable,
SchemaType schemaType
);
[ JScript ]
public function FillSchema (
dataTable : DataTable,
schemaType : SchemaType
) : DataTable;
- dataTable
- The DataTable to be filled with the schema from the data source.
- schemaType
- One of the SchemaType values.
A DataTable that contains schema information returned from the data source.
This version of the FillSchema method adds a DataTable to the current DataSet object and configures the table structure or schema to match that in the data source based on the given SchemaType.
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 DataTable here . . .
DataTable myTable = myDataAdapter.FillSchema (
myDataTable, SchemaType.Mapped );
}
Public Sub FillSchemaDemo ( ( )
' . . . code to initialize DataAdapter and DataTable here . . .
Dim myTable As DataTable = myDataAdapter.FillSchema ( _
myDataTable, SchemaType.Mapped )
End Sub |
|
C# |
VB |
DbDataAdapter Members Fill DbDataAdapter.FillSchema Overload List