Sunteți pe pagina 1din 1

DataTable: The DataTable is a central object in the ADO.NET library.

Other objects that use the DataTable include the DataSet and the DataView. If you are creating a DataTable programmatically, you must first define its schema by adding DataColumn objects to the DataColumnCollection (accessed through the Columns property). You can create a DataTable object by using the DataTable constructor, or by passing constructor arguments to the Add method of the Tables property of the DataSet, which DataTableCollection. You can also create DataTable objects within a DataSet by using the Fill or FillSchema methods of the DataAdapter object. When you first create a DataTable, it does not have a schema ( a structure). To define then schema of the table, you must create and add DataColumn objects to the Columns collection of the table. After you have defined the schema for a DataTable, you can add rows of data to the table by adding DataRow objects to the Rows collection of the table. The DataRowCollection represents the actual DataRow objects in the DataTable, and the DataColumnCollection contains the DataColumn objects that describe the schema of the DataTable. The DataColumnCollection defines the schema of a DataTable, and determines what kind of data each DataColumn can contain. You can access the DataColumnCollection through the Columns property of the DataTable object. The DataRowCollection is a major component of the DataTable. While the DataColumnCollection defines the schema of the table, the DataRowCollection contains the actual data for the table, where each DataRow in DataRowCollection represents a single row. Lets write a small code which helps you to understand dataTable.

S-ar putea să vă placă și