Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 93

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

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