TAILIEUCHUNG - Add and Delete Rows in a Dataset with ADO.NET

4,2 Thêm và dòng Delete trong một Dataset với Một lần nữa bằng cách sử dụng OleDbDataAdapter và OleDbCommandBuilder đối tượng, điều này thế nào-Để cho bạn thấy làm thế nào để sử dụng điều khiển cởi ra với các tập dữ liệu để thêm và xóa các hàng từ SQL Server. | Add and Delete Rows in a Dataset with Again using the OleDbDataAdapter and OleDbCommandBuilder objects this How-To shows you how to use unbound controls with the dataset to add and delete rows from SQL Server. As with editing and updating data you need to be able to add and delete rows using the dataset. How do you perform this task Technique The main difference between this technique and the previous one will be which action command you will use with the DataAdapter object. You will also be presented with the Add method on the Rows collection. 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 click on the Load List button to display the customers that begin with the letter A. Click the Add button. You will notice that the fields have now taken on a sunken look and that they are cleared. Fill in the Customer ID and Company Name text boxes with AAA1 and Another Example. Now click Save. If you move off the record and move back on you will notice that the value has been saved. Now select the new record you added and click the Delete button. The record disappears and the list box is updated to reflect the deletion. 1. Make a copy of the form you created in the last How-To. 2. Add two buttons for adding and deleting records setting the properties as listed here in Table . Table . Add and Delete Buttons Property Settings Object Property Setting Button Name btnAdd Caption Add Button Name btnDelete Text Delete 3. Add the following line of code where you placed the other module-level variable declarations. This variable will be set to True in the btnAdd click event and it can be used when saving the record. 4. Dim mblnAdd As Boolean 5. Enter the following code to the Click event btnAdd. The first task is to set the mblnAdd variable to True. Then the routine clears the current text in the text boxes. It also enables the text boxes by calling ActiveEditing. 6. .

Đã 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.