TAILIEUCHUNG - Using Stored Procedures to Add, Modify, and Remove Rows from the Database phần 1

Using Stored Procedures to Add, Modify, and Remove Rows from the Database You can get a DataAdapter object to call stored procedures to add, modify, and remove rows from the database. | Using Stored Procedures to Add Modify and Remove Rows from the Database You can get a DataAdapter object to call stored procedures to add modify and remove rows from the database. These procedures are called instead of the INSERT UPDATE and DELETE statements you ve seen how to set in a DataAdapter object s InsertCommand UpdateCommand and DeleteCommand properties. The ability to call stored procedures using a DataAdapter is a very powerful addition to . For example you can use a stored procedure to add a row to a table containing an identity column and then retrieve the new value for that column generated by the database. You can also do additional work in a stored procedure such as inserting a row into an audit table when a row is modified. You ll see examples of both these scenarios in this section. Tip Using stored procedures instead of INSERT UPDATE and DELETE statements can also improve performance. You should use stored procedures if your database supports them. SQL Server and Oracle support stored procedures. Oracle stored-procedures are written in PL SQL. The ProductID column of the Products table is an identity column and you saw a number of stored procedures in Chapter 4 Introduction to Transact-SQL Programming that added a row to the Products table and returned the ProductID. In this section you ll see how to Create the required stored procedures in the Northwind database. Set up a DataAdapter to call the stored procedures. Add modify and remove a DataRow to from a DataTable. The C methods shown in this section follow the same steps as shown in the earlier section Modifying Rows in a DataTable. Note You ll find a complete program named in the ch11 directory that illustrates the use of the methods shown in this section. The listing for this program is omitted from this book for brevity. Creating the Stored Procedures in the Database You ll create the following three stored procedures in the Northwind database .

TÀI LIỆU LIÊN QUAN
10    127    1
6    150    1
7    127    1
5    125    1
6    127    1
6    115    1
6    122    1
6    174    1
7    122    1
5    97    1
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.