TAILIEUCHUNG - create and Execute On-the-Fly Batch Updates by Using ADO.NET

4,4 Tạo và Execute On-the-Fly cập nhật hàng loạt khi sử dụng Đôi khi trong các ứng dụng cơ sở dữ liệu, bạn muốn tạo ra và thực hiện các thủ tục được lưu trữ mà hiện tại không tồn tại. | Create and Execute On-the-Fly Batch Updates by Using Sometimes in database applications you want to create and execute stored procedures that don t currently exist. When you have a situation in which you need to use highly dynamic stored procedures that might use criteria that is entirely created at runtime you might need to create those stored procedures on-the-fly. This How-To shows you how to create and execute these stored procedures. It s great that you can execute stored procedures that are already created but what if you need to generate one at runtime How do you do this Technique To perform this How-To you will be utilizing the OleDBCommand object and feeding in the CommandText property from a text box. The text box is set to Update Employees Set City Redmond Where City Seattle to give you something to start with. Steps Open and run the 4 solution. From the main form click on the command button with the caption How-To . When the form loads you will see an example update statement in a text box. Click on the Execute button to execute the update statement. A TextBox control is then displayed on the bottom of the form showing the number of records that are affected. You can the form in Figure . Figure . This form uses the Command object with a SQL statement passed to execute the specified action. Note The number of records affected might be different on your system depending on what you have been doing with the Northwind data. 1. Create a new Windows Form. 2. Add the following controls setting the properties as listed in Table . Table . Controls Property Settings Object Property Setting Label Name Caption Labell Update Statement to Execute Button Name btnExecute TextBox Name Text txtSQL Update Employees Set City Redmond Where City Seattle MultiLine True Label Name Caption Label2 Records Affected TextBox Name txtRecsAffected 3. Enter the following code to the Click event btnExecute. When the command is instantiated in .

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.