Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to parse DAO.NET DataTable objects

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about how to parse DAO.NET DataTable objects, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

1. Delete or remove a row of data from a table

When a user processes data in a table, it is sometimes necessary to remove one or more rows from the table. Note, however, that removing (removing) a line is different from deleting a line as a Deleted. Removing a row means physically removing the row from the dataset. This difference is important when preserving values in a table or data store is discussed later.

To remove a row from a table, you can use its index or actual instance to call the Remove method of the table RowsCollection

Dt.Rows.Remove (3)

After calling this method, the specified row is removed from the rowset

Dt.Rows [3] .Delete

Marking a row as Deleted indicates that the row is removed from the table when the AcceptChanges method of the DAO.NET DataTable object is called. Thus, the RowState property of the row is Deleted. Conversely, if the RejectChanges method is called, the RowState property of this line will revert to the state it was before it was marked Deleted.

two。 Data filtering for dealing with tables

DataRow [] CurrRows = dt.Select (condition)

The Select method allows the user to retrieve rows on the basis of three elements: filter expression, sort order, and by DataViewState.

3. Dataset Datset

The dataset provides two basic constructors

Public DataSet () public DataSet (string DataSetName)

4. Add a data table to the dataset

DataTable dt= new DataTable ("User"); DataSet ds=new DataSet (); ds.Tables.Add (dt)

5. Add a relationship between two tables

Because a DataSet can contain multiple DAO.NET DataTable objects, there must be a way to associate tables with each other. This is necessary to navigate between tables and return relevant values.

The basic arguments to DataRelation are the two columns in the relationship that are the primary key and the external key, as well as the name of the DataRelation. This name can then be used to navigate or retrieve numeric values.

Ds.Relations.Add (...); dr = new DataRelation (...); ds.Relations.Add (dr); Managed Provider

Command, Connection and DataReader

Command, Connection, and DataReader represent core elements of the ADO model. Connection knows how to connect to specific data stores. Microsoft provides two Connection objects in the NGWS framework: SQLConnection and ADOConnection. SQLConnection knows how to connect to a Microsoft SQL Server database.

6. Set up table and column mapping

WorkDSCMD.TableMappings.Add ("Table", "MyAuthors"); / Table mapping workDSCMD.TableMappings [0] .ColumnMappings.Add ("au_id", "AuthorID"); / / column mapping above is how to parse DAO.NET DataTable objects, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report