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

正文內(nèi)容

[理學(xué)]第4章調(diào)用sqlserer2005數(shù)據(jù)庫-資料下載頁

2025-10-07 23:12本頁面
  

【正文】 nd對象代碼如下: ? string deleteString = delete from Categories where CategoryName = 39。Other39。 ? SqlCommand cmd = new SqlCommand()。 ? = deleteString。 ? = conn。 ? ()。 河池學(xué)院 網(wǎng)絡(luò)數(shù)據(jù)庫開發(fā) 對數(shù)據(jù)進(jìn)行操作 ? 返回單一值 ? 實(shí)現(xiàn)返回單一值功能的 SqlCommand對象代碼如下: ? SqlCommand cmd = new SqlCommand(select count(*) from Categories, conn)。 ? count = (int)()。 ? 案例 P136 河池學(xué)院 網(wǎng)絡(luò)數(shù)據(jù)庫開發(fā) 實(shí)現(xiàn)對象之間的關(guān)聯(lián) ? 在實(shí)際應(yīng)用中,在構(gòu)造各種 SQL 語句時(shí),需要使用參數(shù)化的 SQL語句,因此就需要使用參數(shù)化的 SqlCommand對象。 ? 首先新建參數(shù)化的 SqlCommand對象,再定義 SqlParameter對象,實(shí)現(xiàn) SqlParameter對象和 SqlCommand對象的關(guān)聯(lián)。 ? 具體方法如下: ? String inputCity=“beijing”。 ? SqlCommand cmd = new SqlCommand( select * from Customers where city = @City, conn)。 (new SqlParameter(@city, inputCity))。 reader = ()。 河池學(xué)院 網(wǎng)絡(luò)數(shù)據(jù)庫開發(fā) 處理結(jié)果對象 SqlDataReader ? 使用 DataReader類可以實(shí)現(xiàn)對特定數(shù)據(jù)源中的數(shù)據(jù)進(jìn)行高速、只讀、只向前的數(shù)據(jù)訪問。與數(shù)據(jù)集 (dataSet)不同, DataReader是一個(gè)依賴于連接的對象。就是說,它只能在與數(shù)據(jù)源保持連接的狀態(tài)下工作。 ? 因此執(zhí)行的過程往往是: ? 首先打開與數(shù)據(jù)源的連接; ? 調(diào)用 DataReader類的 Read()方法; ? 操作 DataReader對象; ? 調(diào)用 DataReader類 Close()方法; ? 然后關(guān)閉與數(shù)據(jù)源的連接。 河池學(xué)院 網(wǎng)絡(luò)數(shù)據(jù)庫開發(fā) 處理結(jié)果對象 SqlDataReader ? DataReader 對象中數(shù)據(jù)的主要方法: ? SqlDataReader sdr。 ? (0) //讀取第 1字段的值 ? (強(qiáng)制轉(zhuǎn)換類型 )sdr[“字段名 ” ] ? (強(qiáng)制轉(zhuǎn)換類型 ) Sdr[列標(biāo) ] //列下標(biāo)從 0開始 河池學(xué)院 網(wǎng)絡(luò)數(shù)據(jù)庫開發(fā) 處理結(jié)果對象 SqlDataReader ? SqlDataReader對象 ? Try ? { ? //數(shù)據(jù)訪問代碼 ? } ? finally ? { ? if (rdr != null) ? { ? ()。 ? } ? }
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1