Practical .NET Data Access Layer - 22

zhaozj2021-02-16  52

OK, before ending the entire "My Program", the author finally "dedicated"

Code (is it a little dizzy?), I hope to have a success for your DAF Jack.

Code 17: Update data via DAF

// Create a Customer Data Access Object

Customerdaf Daf = New CustomerDaf ();

// Create a Customer data entity object, set the object field value

Customer Cust_1 = New Customer ();

Cust_1.id = "Alfki";

Cust_1.phone = "12345678";

/ / Update data storage according to Customer Data Entity Object

Daf.UpdateCustomer (Cust_1);

// Create a Customer data entity object, including a list of data in this object

Customer Cust_2 = New Customer (New ArrayList ());

// Declare another Customer data entity object, which is used to insert data into

/ / In the list of the above Customer data entity object

Customer Cust_Obj = NULL;

// Create a Customer data entity object, set the object field value and insert it into a CUST_2 entity object

Cust_Obj = new customer ();

Cust_obj.id = "anatr";

Cust_obj.name = "Willian.zhang";

Cust_2.add (Cust_Obj);

// Create a Customer data entity object, set the object field value and insert it into a CUST_2 entity object

Cust_Obj = new customer ();

Cust_obj.id = "Anton";

Cust_obj.name = "xuefeng.zhang";

Cust_2.add (Cust_Obj);

/ / Update data storage based on data list in the Customer data entity object

Daf.UpdateCustomers (CUST_2);

Next paragraph: http://www.9cbs.net/develop/read_article.asp? Id = 27567

转载请注明原文地址:https://www.9cbs.com/read-24086.html

New Post(0)