freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c數(shù)據(jù)庫操作ppt課件-資料下載頁

2025-01-06 13:54本頁面
  

【正文】 。 DataSet。 DataSet對象是一個數(shù)據(jù)集 , 主要用來存放從數(shù)據(jù)庫中取回的數(shù)據(jù) 。 命令格式: DataSet 對象名 =new DataSet()。 例 : DataSet myDataSet=new DataSet()。 數(shù)據(jù)集是包含數(shù)據(jù)表的集合 , 數(shù)據(jù)表包含數(shù)據(jù)行和列的集合 , 即 DataSet對象包含數(shù)據(jù)表的集合 Tables,而 DataTable對象包含數(shù)據(jù)行的集合 Rows、 數(shù)據(jù)列的集合 Columns。 因此可以直接使用這些對象訪問數(shù)據(jù)集中的數(shù)據(jù) 。 例 : =[0].Rows[3].ItemArray[1].ToString()。 : ( 1) 與數(shù)據(jù)庫建立連接 ( 創(chuàng)建 Connection對象 ) 如果用 OleDbConnection命令建立連接,應(yīng)加入如下代碼: using 。 連接的兩個重要方法: Open()方法 Close()方法 例: string strCon=“Provider=。Data Source=d:\\”)。 OleDbConnection myconn=new OleDbconection(strCon)。 myconn().Open()。 …… Myconn().Close()。 ( 2)執(zhí)行 SQL命令(創(chuàng)建 Command對象) SQL命令主要有 SELECT、 INSERT、 UPDATE、 DELETE。 ( 3) 數(shù)據(jù)集編程 ( 創(chuàng)建 DataSet對象 ) 在 ,建立連接后就需要使用數(shù)據(jù)命令打包 SQL語句或存儲過程。數(shù)據(jù)集就是臨時存儲從數(shù)據(jù)庫檢索的記錄,是從數(shù)據(jù)源檢索的記錄的緩存,數(shù)據(jù)集中可包含一個或多個表,這些表基于實際數(shù)據(jù)庫中的表。 因為數(shù)據(jù)集實際上是數(shù)據(jù)庫的私有副本,所以它不一定反映數(shù)據(jù)庫的當(dāng)前狀態(tài)。如果想要查看其他用戶進行的最新更改,可以通過調(diào)用適當(dāng)?shù)?Fill()方法刷新數(shù)據(jù)集。 ( 4) 數(shù)據(jù)綁定 ( 創(chuàng)建 DataAdapter) Windows窗體的數(shù)據(jù)綁定便于在窗體控件中顯示數(shù)據(jù) , 如果使用DataGrid控件 , 則需要使用 DataGrid控件進行綁定 。 主要通過 Fill()方法 。 ( 5) 用戶界面 即將數(shù)據(jù)庫內(nèi)容顯示給用戶并可進行修改的界面 。 例: 其中窗體的 “ Load”事件代碼為: private void Form1_Load(object sender, e) { try{ string strCon=“Provider=。Data Source=f:\\書 .mdb。 OleDbConnection myConn=new OleDbConnection(strCon)。 string strCom=SELECT * FROM book order by 編號 。 ()。 OleDbDataAdapter myCommand=new OleDbDataAdapter(strCom,myConn)。 myDataSet=new DataSet()。 (myDataSet,book)。 =[book]。 ()。 } catch(Exception x) { (“錯誤!” +(), “error”)。 } } 其中 “ 查詢 ” 按鈕的 “ 單擊 ” 事件代碼為: private void button1_Click(object sender, e) { try{ string strCon=“Provider=。Data Source=f:\\書 .mdb。 OleDbConnection myConn=new OleDbConnection(strCon)。 ()。 string strCom=“SELECT * FROM book WHERE 書名 Like 39。%++%39。 OleDbDataAdapter myCommand=new OleDbDataAdapter(strCom,myConn)。 ()。 (myDataSet,book)。 ()。 } catch(Execption x) { (“錯誤!” +(), “error”)。 } } 本章作業(yè): 1. 習(xí)題 10的 1— 2。 實驗報告: 實驗九
點擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1