ArticleDirectory
1. Ado. net
2. Advantages of ADO. net
3. Ado. Net Document Object Model
1.1ado.net
Ado. Net is a standard-basedProgramDesign model, which can be used to create distributed applications for data sharing
Dataset plays an important role in ADO. net. It is a copy of some data in the database in the memory. And ADO
Different from the recordset in, dataset can include any data table. Each data table can be used to represent a database table or view.
. Dataset resides in the memory and is not connected to the original database, that is, it does not need to be connected to the original database.
The underlying technology used to complete the work is XML, which is the storage and transmission format used by dataset. Components
(For example, a business logic object or Asp.net web form) needs to exchange data in dataset. The data is in the form of an XML file from a component
Transfer to another component, and the receiving component restores the file to the dataset form. Dataset has the same method as the relational data model.
2.1advantages of ado.net
2.1.1 interoperability
2.1.2 maintainability
2.1.3 programmability
2.1.4 High Performance
2.1.5 scalability
3.1ado.net Document Object Model
Ado. Net consists of dataset and managed provider. Dataset consists of a relationscollection and a tablescollection.
. Each able in tablescollection includes the columns set and rows set.
3.1.1datatable
Add a able to Dataset: DataSet mydataset = new dataset (); mydataset. Tables. Add (New datatable ("Products "));
Multiple datacolumns can be created in a column set of a table, including:
- Standard Column
- Expression Column
- Auto-increment Column
Dataset mydataset = new dataset (); datacolumn [] keys = new datacolumn [1]; mydataset. tables. add (New datatable ("Products"); mydataset. tables ["Products"]. columns. add ("ID", type. getType ("system. int32 "); mydataset. tables ["Products"]. columns. add ("name", type. getType ("string"); mydataset. tables ["Products"]. columns. add ("cost", double); keys [0] = mydataset. tables ["Products"]. columns ["ID"]; mydataset. tables [0]. primarykey = keys;
A Data row is a child element of a able. It represents a row of data in the original database and has a rowstate attribute.
Dataset mydataset = new dataset (); datacolumn [] keys = new datacolumn [1]; mydataset. tables. add (New datatable ("Products"); mydataset. tables ["Products"]. columns. add ("ID", type. getType ("system. int32 "); mydataset. tables ["Products"]. columns. add ("name", type. getType ("string"); mydataset. tables ["Products"]. columns. add ("cost", double); keys [0] = mydataset. tables ["Products"]. columns ["ID"]; mydataset. tables [0]. primarykey = keys; datarow myrow = NULL; myrow = mydataset. tables [0]. newrow (); myrow ["ID"] = 1; myrow ["name"] = "Wangdi"; myrow ["cost"] = 19.58; mydataset. tables [0]. rows. add (myrow );
3.1.2 Data Relationship
3.1.3 Constraints