Asp. Summary of the usage of Datatable,dataset,dataview in net

Source: Internet
Author: User
Tags table name

This article mainly introduces the use of Datatable,dataset, attribute summary type, so only throw emphasis. About Datatable,dataset Here is a brief description: The DataSet is a dataset, it can contain a DataTable, and the relationships between the data tables, the DataTable is a datasheet, a column of columns, rows, and so on. DataView is a view used to create different views of the data stored in a DataTable, typically for data binding, as follows:

DataView DV = ds. tables["table name"]. DefaultView;

DATAGRID1.DATASOURCE=DV;

The popular point is: DataSet: Datasets. Can contain multiple DataTable, such as dataset["table name" to get datatable;datatable: Data table. Usage Example One:

SqlDataAdapter Da=new SqlDataAdapter (CMD);

DataTable dt=new DataTable ();

Da. Fill (DT);

Put the data results directly into the DataTable. Usage Example two:

SqlDataAdapter Da=new SqlDataAdapter (CMD);

DataSet dt=new DataSet ();

Da. Fill (DT);

The data results are placed in the dataset, and to use that DataTable, you can do this: dataset[0], the following usage is also quite common:

SqlDataAdapter Da=new SqlDataAdapter (CMD);

DataSet Dt=new DataSet ();d A. Fill (DT, "table1");//Use the time: So take datatable:dataset["Table1"]

There is also the use of online collection:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.