How to analyze DataSet objects and use them
Concept of DataSet object:
DataSet object can be regarded as a (Catch), it can retain the data found from the database, and even temporarily store the entire database
DataSet is the representation of data in memory
The connection between the DataSet object and the data source occurs very briefly. We disconnect from the data source immediately after obtaining the data. We wait until the data is modified or needs to be No connection will be established until the data in the data source is manipulated.
The DataSet object contains a set of DataTable objects and DataRelation objects.
DataTable objects and their use.
The DataTable object is an important object of the DataSet. One, representing a relational data table in memory
Common properties of DataTable objects
TableName: Get or set the name of the table
DataSet: Point out which DataSet the table belongs to
Rows (Add, InsertAt, Remove, RemoveAt): DataRow object collection, which represents the collection of rows of this table
Columns: Data Columns object collection, which represents the collection of columns of this table
Example:
DataSetds = new DataSet();
DataTable student = new DataTable("Student");
DataColumn sno = new DataColumn( "Sno");
sno.DataType = typeof(string);
sno.MaxLength = 8;
DataColumn sname = new DataColumn("Sname");
sno.DataType = typeof(string);
sno.MaxLength = 8;
student.Columns.Add(sno);
student.Columns .Add(sname);
ds.Tables.Add(student);
DataRow drl = student.NewRow();
drl["Sno"] = " 0125";
drl["Sname"] = "Li Shuang";
student.Rows.Add(drl);
DataRow dr2 = student.NewRow();
drl["Sno"] = "0125x";
drl["Sname"] = "xLi Shuang";
student.Rows.Add(dr2);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
The above is the detailed content of How to analyze DataSet objects and use them. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
