In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 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.
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.