In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use the ADO.NET object model database, the article is very detailed, has a certain reference value, interested friends must read it!
If you use the ADO.NET object model directly, when you know what changes to make, you should know how to insert new records, or modify or delete existing records. You must have learned a lot after reading this article. I hope this article will teach you more.
It is very simple to update the data of a single table in the database, but once you need to update the related tables, many things become very complicated. This can use transactions to confirm the integrity of the data, as shown below.
The easiest way to update the database directly with the ADO.NET object is to generate a SQL statement such as Insert, Update, or Delete, and then execute the statement using the ExecuteNonQuery method of the Command object. To do this, create a new Web site called UpdatingDBDirectly. Drag GridView to display the Shipper table, and the ADO.NET object model adds a Select button to the * * column of GridView.
Under GridView, add three buttons and two text boxes. Name the buttons btnAdd, btnEdit, and btnDelete, and the text boxes txtName and txtPhone, respectively, as shown in figure 10-14.
Each button has an event handler. The Add button takes the text from the Name and Phone text boxes, ADO.NET the object model, and passes the command string to UpdateDB to add a new record to the database. When the database is updated, the program calls PopulateGrid again to populate the GridView:
Protected void btnAdd_Click (object sender, EventArgs e) {string cmd = @ "Insert into Shippers values ('" + this.txtName.Text + "','" + this.txtPhone.Text+ "')"; UpdateDB (cmd); PopulateGrid ();} these are all the contents of the article "how to use the ADO.NET object model database". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.