Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Retrieving New Identity Column Values
Đang chuẩn bị liên kết để tải về tài liệu:
Retrieving New Identity Column Values
Minh Thương
59
3
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Retrieving New Identity Column Values The ProductID column of the Products table is an identity column. In this section, you'll see how to insert a new row into to Products table | Retrieving New Identity Column Values The ProductID column of the Products table is an identity column. In this section you ll see how to insert a new row into to Products table and retrieve the new value generated by the database for the ProductID identity column. Note You ll find a complete program named UsingIdentityColumn.es in the ch11 directory that illustrates the use of the methods shown in this section. This program listing is omitted from this book for brevity. In the examples assume you have a DataTable named productsDataTable that is populated with the rows retrieved by the following SELECT statement SELECT ProductID ProductName UnitPrice FROM Products ORDER BY ProductID The following example sets the PrimaryKey property of productsDataTable productsDataTable.PrimaryKey new DataColumn productsDataTable.Columns ProductID The next example sets the AllowDBNull AutoIncrement AutoIncrementSeed AutoIncrementStep ReadOnly and Unique properties for the ProductID DataColumn of productsDataTable DataColumn productIDDataColumn productsDataTable.Columns ProductID productIDDataColumn.AllowDBNull false productIDDataColumn.AutoIncrement true productIDDataColumn.AutoIncrementSeed -1 productIDDataColumn.AutoIncrementStep -1 productIDDataColumn.ReadOnly true productIDDataColumn.Unique true Because of these settings when you add a new DataRow to productsDataTable the ProductID DataColumn of your new DataRow will initially have the value -1. As in the earlier section Modifying Rows in a DataTable you need to set your DataAdapter object s InsertCommand UpdateCommand and DeleteCommand properties with appropriate Command objects. The CommandText property of the Command object used in the UpdateCommand property is as follows myUpdateCommand.CommandText UPDATE Products SET ProductName @NewProductName UnitPrice @NewUnitPrice WHERE ProductID @OldProductID AND ProductName @OldProductName AND UnitPrice @OldUnitPrice The CommandText property of the Command object used in the .
TÀI LIỆU LIÊN QUAN
Retrieving New Identity Column Values
crossorigin="anonymous">
Đã 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.