Use the DataSet and source table names, command strings, and command behavior, add or refresh some rows to the specified range of DataSet to match their corresponding rows in the data source. Protected Virtual Int Fill (DataSet Dataset, Int StartRecord, int maxRecords, String Srctable, IDBCommand Command, Commandbehavior Behavior); parameter
DataSet
To use records and architectures (if necessary)
DataSet.
StartRecord
From the beginning of the record number starting from zero.
MaxRecords
The maximum number of records to retrieve.
SRCTABLE
The name of the source table for the table map.
Command
The SQL SELECT statement used to retrieve the line from the data source.
BEHAVIOR
One of the Commandbehavior values.
The return value has been successfully added or refreshed in the DataSet. This does not include rows that are affected by the statement of the non-return line. abnormal
Anomaly Type Condition InvalidOperationException Source Table is invalid. The argumentExceptionStartRecord parameter is less than 0. - or - MaxRecords parameter is less than 0.
Remarks the Fill method Use the SELECT statement specified by the associated SelectCommand property from the data source from the data source. The connection object associated with the SELECT statement must be valid, but do not need to open it. If the connection is turned off before calling the Fill, open it to retrieve data, and then turn it off. If the connection is turned on before calling the Fill, it will remain open. The Fill operation is then added to the target DataTable object in the DataSet, and these objects are created if the DataTable object does not exist. Fill operations typically create only column metadata when you create a DataTable object. However, if the MissingsChemaAction property is set to AddWithkey, the appropriate primary key and constraint are created. If DBDataAdapter encounters repetition columns when populating DataTable, it will name the column that is named "ColumnName1", "ColumnNAME2", "ColumnName3" mode. If the incoming data contains unnamed columns, they will be placed in the DataSet by "Column1", "Column2" mode. Adding multiple result sets to DataSet, each result set is placed in a separate table. Adding an integer value to the specified table name to naming other result sets (such as "Table", "Table1", "Table2", etc.). Care should be careful when using the column name and table name in the application, you must not conflict with these named patterns. The Fill method supports the following: DataSet contains multiple DataTable objects, and the names of these objects are only different. In this case, Fill performs case-sensitive comparisons to find the corresponding table, if there is no fully matched table, create a new one. The following C # code explains the behavior. DataSet DataSet = New DataSet ();
Dataset.tables.Add ("aaa");
Dataset.tables.Add ("aaa");
Adapter.Fill (Dataset, "AAA"); // Fills "AAA", Which Already EXISTS in The
DataSet. Adapter.Fill (DataSet, "AAA"); // AddS a new table called "AAA". This DataTable is updated if the Fill is called and the DataSet contains only one name. In this case, it is not case sensitive. The following C # code explains the behavior. DataSet DataSet = New Dataset (); Dataset.tables.Add ("AAA");
Adapter.Fill (DataSet, "AAA"); // Fills Table "AAA" Because IS in The DataSet. You can use the Fill method multiple times on the same dataable. If the primary key exists, the incoming guide merges with the existing match line. If the primary key does not exist, the incoming line will be added to the DataTable. If SELECTCOMMAND returns the result of Outer Join, DataAdapter does not set the primaryKey value for the generated DataTable. The primary key must be explicitly defined to ensure that the repetition is correctly parsed. For more information, see
Define primary keys for tables
.
Note that when processing a batch of a number of results, the .NET Framework data provider
Fill and
Fillschema's implementation only retrieves architecture information for the first result.
For the implementator's instructions: This overloading of the Fill method is protected and supplied by the .NET Framework data provider. Requirements Platforms: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Framework Lite - Windows CE .NET See DbDataAdapter Class | DbDataAdapter members | System. Data.Common Namespace | DBDataAdapter.Fill Overloaded list | Fillschema
DBDataAdapter member (Visual J # Syntax) | C hosted extension programming
Send an opinion about this topic
? 2001-2002 Microsoft Corporation. all rights reserved.