Báo cáo tài liệu vi phạm
Giới thiệu
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
THỊ TRƯỜNG NGÀNH HÀNG
NÔNG NGHIỆP, THỰC PHẨM
Gạo
Rau hoa quả
Nông sản khác
Sữa và sản phẩm
Thịt và sản phẩm
Dầu thực vật
Thủy sản
Thức ăn chăn nuôi, vật tư nông nghiệp
CÔNG NGHIỆP
Dệt may
Dược phẩm, Thiết bị y tế
Máy móc, thiết bị, phụ tùng
Nhựa - Hóa chất
Phân bón
Sản phẩm gỗ, Hàng thủ công mỹ nghệ
Sắt, thép
Ô tô và linh kiện
Xăng dầu
DỊCH VỤ
Logistics
Tài chính-Ngân hàng
NGHIÊN CỨU THỊ TRƯỜNG
Hoa Kỳ
Nhật Bản
Trung Quốc
Hàn Quốc
Châu Âu
ASEAN
BẢN TIN
Bản tin Thị trường hàng ngày
Bản tin Thị trường và dự báo tháng
Bản tin Thị trường giá cả vật tư
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
NGÀNH HÀNG
NÔNG NGHIỆP, THỰC PHẨM
Gạo
Rau hoa quả
Nông sản khác
Sữa và sản phẩm
Thịt và sản phẩm
Dầu thực vật
Thủy sản
Thức ăn chăn nuôi, vật tư nông nghiệp
CÔNG NGHIỆP
Dệt may
Dược phẩm, Thiết bị y tế
Máy móc, thiết bị, phụ tùng
Nhựa - Hóa chất
Phân bón
Sản phẩm gỗ, Hàng thủ công mỹ nghệ
Sắt, thép
Ô tô và linh kiện
Xăng dầu
DỊCH VỤ
Logistics
Tài chính-Ngân hàng
NGHIÊN CỨU THỊ TRƯỜNG
Hoa Kỳ
Nhật Bản
Trung Quốc
Hàn Quốc
Châu Âu
ASEAN
BẢN TIN
Bản tin Thị trường hàng ngày
Bản tin Thị trường và dự báo tháng
Bản tin Thị trường giá cả vật tư
Thông tin
Tài liệu Xanh là gì
Điều khoản sử dụng
Chính sách bảo mật
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
ASP.NET 4 Unleased - p 82
Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 82
Xuân Minh
71
10
pdf
Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG
Tải xuống
Using the ObjectDataSource Control public void UpdateMovie(int id, string title, string director, DateTime ➥dateReleased) { // Create Command SqlConnection con = new SqlConnection(_conString); SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = “UPDATE Movies SET Title=@Title,Director=@Director,DateReleased= // Add parameters cmd.Parameters.AddWithValue(“@Title”, title); cmd.Parameters.AddWithValue(“@Director”, director); cmd.Parameters.AddWithValue(“@DateReleased”, dateReleased); cmd.Parameters.AddWithValue(“@Id”, id); // Execute command using (con) { con.Open(); cmd.ExecuteNonQuery(); } } public SqlDataReader GetMovies() { // Create Connection SqlConnection con = new SqlConnection(_conString); // Create Command SqlCommand cmd = new SqlCommand(); cmd.Connection = con; cmd.CommandText = “SELECT Id,Title,Director,DateReleased FROM Movies”; // Return DataReader con.Open(); return. | 784 CHAPTER 18 Using the ObjectDataSource Control public void UpdateMovie int id string title string director DateTime dateReleased Create Command SqlConnection con new SqlConnection _conString SqlCommand cmd new SqlCommand cmd.Connection con cmd.CommandText UPDATE Movies SET Title @Title Director @Director DateReleased Add parameters cmd.Parameters.AddWithValue @Title title cmd.Parameters.AddWithValue @Director director cmd.Parameters.AddWithValue @DateReleased dateReleased cmd.Parameters.AddWithValue @Id id Execute command using con con.Open cmd.ExecuteNonQuery public SqlDataReader GetMovies Create Connection SqlConnection con new SqlConnection _conString Create Command SqlCommand cmd new SqlCommand cmd.Connection con cmd.CommandText SELECT Id Title Director DateReleased FROM Movies Return DataReader con.Open return cmd.ExecuteReader CommandBehavior.CloseConnection public Movies _conString WebConfigurationManager.ConnectionStrings Movies .ConnectionString From the Library of Wow eBook Using Parameters with the ObjectDataSource Control 785 The page in Listing 18.12 contains a GridView and ObjectDataSource control. The ObjectDataSource control includes an UpdateMethod property that points to the UpdateMovie method. LISTING 18.12 ShowMovies.aspx @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML 1.1 EN http www.w3.org TR xhtml11 DTD xhtml11.dtd html xmlns http www.w3.org 1999 xhtml head id Head1 runat server title Show Movies title head body form id form1 runat server div asp GridView id grdMovies DataSourceID srcMovies DataKeyNames Id AutoGenerateEditButton true Runat server asp ObjectDataSource id srcMovies TypeName Movies SelectMethod GetMovies UpdateMethod UpdateMovie Runat server div form body html 18 In Listing 18.12 the GridView automatically adds the update parameters to the ObjectDataSource control s UpdateParameters collection. As an alternative you can declare the parameters used by the ObjectDataSource control explicitly. For example the page in .
TÀI LIỆU LIÊN QUAN
Đã 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.