In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the property of ADO.NET DataAdapter object". In the daily operation, I believe that many people have doubts about what the property of ADO.NET DataAdapter object is. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the question of "what is the property of ADO.NET DataAdapter object?" Next, please follow the editor to study!
DataAdapter objects represent a set of data commands and a database connection to populate DataSet objects and update data sources. As a bridge between the DataSet object and the data source, the DataSet is populated with data by the mapping Fill () method, and the changes in the DataSet object are updated to the database by the Update () method. These operations are actually implemented by four Command named objects, Select, Update, Insert, and Delete, which are contained in the DataAdapter object. It can also be directly combined with the use of Command objects to complete data manipulation.
One of the main features of DataView is to allow data binding on Windows forms and Web forms. In addition, DataView can be customized to represent a subset of data in DataTable. This feature allows you to have two controls that are bound to the same DataTable but display different versions of data. For example, one control might be bound to a DataView that displays all rows in a table, while another control might be configured to display only rows that have been deleted from the DataTable. DataTable also has a DefaultView attribute. It returns the default DataView of the table. For example, if you want to create a custom view on a table, set RowFilter on the DataView returned by DefaultView.
The common methods and properties of DataAdapter objects are shown in the table and table:
Attribute
Description
AcceptChangesDuringFill
Determines whether changes made to lines when copying them into DataTable are acceptable
TableMappings
Holds a collection that provides the primary mapping between the return row and the dataset
Method
Description
Fill ()
Used to add or refresh a dataset to match the dataset with the data source
FillSchema ()
Used to add DataTable to the dataset to match the structure of the data source
Update ()
Store the values in DataSet to the database server
Take a look at the following sample usage code:
Static private DataSet CreateCommandAndUpdate (string connectionString,string queryString) {DataSet dataSet = new DataSet (); using (OleDbConnection connection = new OleDbConnection (connectionString)) {connection.Open (); OleDbDataAdapter dataAdapter = new OleDbDataAdapter (); dataAdapter.SelectCommand = new OleDbCommand (queryString, connection); OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder (dataAdapter); dataAdapter.Fill (dataSet); / / enter the code here to modify the dataset dataSet / / if OleDbCommandBuilder is not used, this line will report an error dataAdapter.Update (dataSet);} return dataSet;}
In the code example, we first use dataAdapter.Fill () to populate the data from the data source to the dataset dataSet;*** and then use dataAdapter.Update () to return the data from the dataset dataSet to the data source.
At this point, the study on "what are the properties of the ADO.NET DataAdapter object" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.