viewbarcode.com

Develop Stored Procedures to Perform the Data Deletion in .NET Attach PDF 417 in .NET Develop Stored Procedures to Perform the Data Deletion




How to generate, print barcode using .NET, Java sdk library control with example project source code free download:
7.8.2 Develop Stored Procedures to Perform the Data Deletion use none none generator toproduce none with none .NET Framework 3.5 As we discussed a none for none t the beginning of this section, to delete a record from a relational database, one must follow the correct sequence. In other words, one must rst delete. 7.8 Develop an ASP.NET Web Application to Update and Delete Data in Oracle Databases the records that none for none are related to the record to be deleted in the parent table from the child tables. For example, in our application, to delete a record from the Faculty table, one must rst delete the related records from the LogIn and Course tables, and then one can delete the desired record from the Faculty table. The reason is that the faculty id is a primary key in the Faculty table, but it is a foreign key for other tables.

Based on the analysis above, it can be seen that to delete one record from a parent table such as the Faculty table in our sample database, many delete queries will be executed to rst delete related records from the child tables such the LogIn and Course tables, and then delete the target record from the parent table. An easy way to perform these multiple deleting queries is to use a stored procedure to perform this data deletion..

7.8.2.

1 Delete an Existing Record from the Faculty Table Recall that in Section 6.8.4 in 6, we discussed how to develop a stored procedure in the Oracle database and use that stored procedure to perform the data deleting operation in the Oracle database.

In this section we still want to use our Faculty table as an example to show how to delete an existing record from related tables. In our sample database, there are two child tables related to our Faculty table, the LogIn table and the Course table. These two child tables are connected with the Faculty table by using the faculty id, which is a primary key in the Faculty table and a foreign key in the child tables.

To delete a faculty member from the parent table, or the Faculty table, one must rst delete those records that are related to that faculty member in the parent table from the child tables, such as the LogIn and Course tables, and then one can delete that faculty member from the Faculty table. Basically, this deleting can be divided into the following three steps or three queries:. 1. Delete all rec none none ords that are related to the faculty member to be deleted in the Faculty table from the LogIn table. In our sample database, only one row is related to each faculty member in the LogIn table.

2. Delete all records that are related to the faculty member to be deleted in the Faculty table from the Course table. In our sample database, there are four to six records related to each faculty member in the Course table since each faculty member can teach four to six courses.

3. Delete the faculty member from the parent table, the Faculty table. These three steps are exactly equivalent to three deleting queries, and we can combine these three queries into a single stored procedure.

By calling and executing this stored procedure, we can easily complete this complex data deleting operation. The complete data deleting operation can be divided into the following three steps: 1. Develop the stored procedure in the Oracle database to perform the multitable data deleting functionality.

2. Call the stored procedure from the ASP.NET Web application to perform the data deletion in the Oracle database.

3. Validate the data deletion after the data deleting operation..

Accessing Data in ASP.NET Figure 7.70. The code for the Delete button s click event procedure. To save time and space, we will not provide a duplicated discussion of how to create a stored procedure in the Oracle database environment to perform this data deleting operation since we discussed this topic in great detail in Section 6.8.4.

1. Refer to that section to get more detailed material about this issue. We will use the stored procedure DeleteFaculty, which was developed in Section 6.

8.4.1, to perform data deletion in this section.

In the following part, we assume that we have nished developing the stored procedure DeleteFaculty and we only take care of the coding for steps 2 and 3.. 7.8.2.

2 Develop t none for none he Code for the Delete Button s Click Event Procedure Open the Delete button s click event procedure by double-clicking the Delete button from the Faculty Web form window, and enter the code shown in Figure 7.70 into this event procedure. Let s take a closer look at this piece of code to see how it works.

. A. The content of the query string is now equal to the name of the stored procedure DeleteFaculty that we created in the Oracle database in Section 6.8.

4.1. Refer to that section to get the detailed code for this stored procedure.

When calling a stored procedure, the content of the query string must be equal to the name of the stored procedure. B. The data object and local variable used in this procedure are declared here.

The integer variable intDelete is used to hold the value returned by executing the data updating method ExecuteNonQuery() of the Command class later. C. The Command object is initialized with the associated objects.

The rst object is the Connection object oraConnection that is stored in the Application state. D. The next object is the Command type.

The CommandType.StoredProcedure must be assigned to this Command type property to make sure that the application will call a stored procedure as a query while the project runs..

Copyright © viewbarcode.com . All rights reserved.