search
HomeOperation and MaintenanceSafetyHow 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!

Statement
This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Article

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor