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
ASP.NET 4 Unleased - p 93
Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 93
Nhã Yến
160
10
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Building Data Access Components with ADO.NET void Page_Load() { // Create connection string connectionString = WebConfigurationManager.ConnectionStrings[“Movies”].ConnectionString; SqlConnection con = new SqlConnection(connectionString); // Create Select command dad = new SqlDataAdapter(“SELECT Id,Title,Director FROM Movies”, con); // Create Update, Insert, and Delete commands with SqlCommandBuilder SqlCommandBuilder builder = new SqlCommandBuilder(dad); // Add data to DataTable dtblMovies = new DataTable(); dad.Fill(dtblMovies); // Bind data to Repeater rptMovies.DataSource = dtblMovies; rptMovies.DataBind(); } protected void lnkUpdate_Click(object sender, EventArgs e) { // Update DataTable with changes for (int i=0; i . | 894 CHAPTER 19 Building Data Access Components with ADO.NET void Page_Load Create connection string connectionstring WebConfigurationManager.ConnectionStrings Movies .ConnectionString SqlConnection con new SqlConnection connectionString Create Select command dad new SqlDataAdapter SELECT Id Title Director FROM Movies con Create Update Insert and Delete commands with SqlCommandBuilder SqlCommandBuilder builder new SqlCommandBuilder dad Add data to DataTable dtblMovies new DataTable dad.Fill dtblMovies Bind data to Repeater rptMovies.DataSource dtblMovies rptMovies.DataBind protected void lnkUpdate_Click object sender EventArgs e Update DataTable with changes for int i 0 i rptMovies.Items.Count i Repeateritem item rptMovies.Items i TextBox txtTitle TextBox item.FindControl txtTitle TextBox txtDirector TextBox item.FindControl txtDirector if dtblMovies.Rows i Title txtTitle.Text dtblMovies.Rows i Title txtTitle.Text if dtblMovies.Rows i Director txtDirector.Text dtblMovies.Rows i Director txtDirector.Text Set batch size to maximum size dad.UpdateBatchSize 0 Perform update int numUpdated dad.Update dtblMovies lblResults.Text String.Format Updated 0 rows numUpdated script html xmlns http www.w3.org 1999 xhtml head id Head1 runat server From the Library of Wow eBook Disconnected Data Access 895 title Show DataAdapter Update title head body form id form1 runat server div asp Repeater id rptMovies EnableViewState false Runat server HeaderTemplate table tr th Title th th Director th tr HeaderTemplate ItemTemplate tr td asp TextBox id txtTitle Text Eval Title Runat server td td asp TextBox id txtDirector Text Eval Director Runat server td tr ItemTemplate FooterTemplate table FooterTemplate asp Repeater br asp LinkButton id lnkUpdate Text Update Movies Runat server OnClick lnkUpdate_Click br br 19 From the Library of Wow eBook 896 CHAPTER 19 Building Data Access Components with ADO.NET asp Label id lblResults EnableViewState false Runat server div form body html The .
TÀI LIỆU LIÊN QUAN
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.