第五章 實現Windows程式的資料繫結

來源:互聯網
上載者:User

標籤:table   記憶體   實現   單元   this   一個   command   .net   grid   

第五章 實現Windows程式的資料繫結

 

1. 資料使用DataSet存放資料

 

使用ComboBox進行資料繫結

 

使用DataGridView進行資料繫結

 

使用DataSet實現資料更新

 

2.ADO.NET的兩大部分

 

串連式

 

SqlConnection

 

SqlCommond

 

SqlDataReader

 

斷開式

 

SqlConnection

 

DataAdapter

 

DataSet-->DataTable

 

簡單理解為一個臨時資料庫

 

將資料來源的資料儲存在記憶體中

 

斷開式與串連式有什麼區別?

 

斷開式不用開啟與關閉資料庫,資料少的時候,可以用斷開式,

 

當資料量大的時候,一定要用串連式  

3.ComBox與DataTable1.this.cbo1.DataSource=DataTable ;2.this.cbo1.DisplayMember = dt.Colums[1] ;3.this.cbo1.ValueMember = dt.Colums[0] ;4.DataGradeView與DataTable

AutoSizeColumnMode:Fill-->儲存格平均分配DataGrideView寬度

1.當表單載入完成後,就要給DataGrideView綁定資料2.搜尋出來的資料繫結給DataGradeView3.更新

SqlCommandBuilder builder =

new SqlCommandBuilder(da);-->builder會自動根據da中資料的變化,產生相應的命令,Insertcommond,UpdateCommd,DeleteCommond,

da.Update(ds);-->把UpdateCommond發送給資料庫\

第五章 實現Windows程式的資料繫結

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.