偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

DBOperate應(yīng)用之將圖片以二進(jìn)制存入數(shù)據(jù)庫(kù)中

數(shù)據(jù)庫(kù)
本文我們主要介紹了一個(gè)DBOperate應(yīng)用之將圖片以二進(jìn)制存入數(shù)據(jù)庫(kù)中的實(shí)例,通過(guò)它讓我們一起來(lái)了解一下DBOperate應(yīng)用之將圖片以二進(jìn)制存入數(shù)據(jù)庫(kù)中的過(guò)程吧,希望能夠?qū)δ兴鶐椭?/div>

DBOperate應(yīng)用之將圖片以二進(jìn)制存入數(shù)據(jù)庫(kù)中的實(shí)現(xiàn)方法是本文我們主要要介紹的內(nèi)容,接下來(lái)就讓我們一起來(lái)了解一下這部分內(nèi)容吧,希望能夠?qū)δ兴鶐椭?/p>

  1. /// <summary> 
  2. /// 將圖片以二進(jìn)制存入數(shù)據(jù)庫(kù)中  
  3. /// </summary> 
  4. /// <param name="MID">員工編號(hào)</param> 
  5. /// <param name="openF">打開文件對(duì)話框?qū)ο?/span></param> 
  6. public void SaveImage(string MID, OpenFileDialog openF)  
  7. {  
  8. string P_str = openF.FileName;//得到圖片的所在路徑  
  9. FileStream fs = new FileStream(//創(chuàng)建文件流對(duì)象  
  10. P_str, FileMode.Open, FileAccess.Read);  
  11. BinaryReader br = new BinaryReader(fs);//創(chuàng)建二進(jìn)制讀取器  
  12. byte[] imgBytesIn = br.ReadBytes((int)fs.Length);//將流讀入到字節(jié)數(shù)組中  
  13. conn.Open();//打開數(shù)據(jù)庫(kù)連接  
  14. StringBuilder strSql = new StringBuilder();//創(chuàng)建字符串構(gòu)造器  
  15. strSql.Append(//附加字符串  
  16. "update tb_employee Set employeePhoto=@Photo where employeeID=" + MID);  
  17. SqlCommand cmd = new SqlCommand(strSql.ToString(), conn);//創(chuàng)建命令對(duì)象  
  18. cmd.Parameters.Add("@Photo", SqlDbType.Binary).Value = imgBytesIn;//添加參數(shù)  
  19. cmd.ExecuteNonQuery();//執(zhí)行SQL命令  
  20. conn.Close();//關(guān)閉數(shù)據(jù)庫(kù)連接  

 

以上就是DBOperate應(yīng)用之將圖片以二進(jìn)制存入數(shù)據(jù)庫(kù)中的實(shí)現(xiàn)代碼的全部?jī)?nèi)容,本文我們就介紹到這里了,希望本次的介紹能夠?qū)δ兴斋@!

【編輯推薦】

  1. 初學(xué)SQL Server數(shù)據(jù)庫(kù)的一些常用操作總結(jié)
  2. SQL Server數(shù)據(jù)庫(kù)創(chuàng)建數(shù)據(jù)倉(cāng)庫(kù)已分區(qū)表詳解
  3. SQL Server與Access數(shù)據(jù)庫(kù)ASP代碼的比較詳解
  4. SQL Server數(shù)據(jù)庫(kù)中bit字段類型使用時(shí)的注意事項(xiàng)
  5. SQL Server數(shù)據(jù)庫(kù)timestamp數(shù)據(jù)類型相關(guān)知識(shí)介紹
責(zé)任編輯:趙鵬 來(lái)源: 博客園
相關(guān)推薦

2025-01-26 10:21:54

2013-07-29 11:19:16

iOS開發(fā)iOS開發(fā)學(xué)習(xí)FMDB更新二進(jìn)制圖片

2018-10-22 14:37:16

二進(jìn)制數(shù)據(jù)存儲(chǔ)

2017-04-11 10:48:53

JS二進(jìn)制

2022-07-18 09:01:15

SwiftApple二進(jìn)制目標(biāo)

2022-04-21 08:37:29

應(yīng)用業(yè)務(wù)二進(jìn)制

2023-09-20 00:02:33

C++14二進(jìn)制字面量

2009-08-12 16:52:10

.NET二進(jìn)制圖片存儲(chǔ)

2009-02-27 09:37:33

Google二進(jìn)制代碼

2022-10-31 08:02:42

二進(jìn)制計(jì)算乘法

2022-01-14 11:39:46

BOLTFacebookLLVM

2009-07-21 13:40:24

ASP.NET上傳圖片顯示圖片

2010-06-09 13:02:29

MySQL啟用二進(jìn)制日

2010-10-13 15:45:23

MySQL二進(jìn)制日志

2009-08-12 18:06:53

C#讀取二進(jìn)制文件

2009-12-16 10:49:42

Ruby操作二進(jìn)制文件

2022-07-26 13:00:01

安全符號(hào)源代碼

2010-02-26 16:10:50

WCF傳送二進(jìn)制流數(shù)據(jù)

2024-01-31 09:55:53

2021-01-14 09:40:54

漏洞macOS屬性表文件
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)