国产亚洲精品福利在线无卡一,国产精久久一区二区三区,亚洲精品无码国模,精品久久久久久无码专区不卡

當前位置: 首頁 > news >正文

湖州做網(wǎng)站建設(shè)的公司女教師遭網(wǎng)課入侵直播錄屏曝光se

湖州做網(wǎng)站建設(shè)的公司,女教師遭網(wǎng)課入侵直播錄屏曝光se,怎樣提高網(wǎng)站的打開速度,昆明網(wǎng)站優(yōu)化推廣平臺圖片存入ole字段,看有的代碼是獲取圖片的字節(jié)數(shù)組轉(zhuǎn)換為base64字符串,存入數(shù)據(jù)庫;顯示圖片是把base64字符串轉(zhuǎn)換為字節(jié)數(shù)組再顯示;直接存字節(jié)數(shù)組可能還好一點; 插入的時候用帶參數(shù)的sql寫法比較好;用拼接…

圖片存入ole字段,看有的代碼是獲取圖片的字節(jié)數(shù)組轉(zhuǎn)換為base64字符串,存入數(shù)據(jù)庫;顯示圖片是把base64字符串轉(zhuǎn)換為字節(jié)數(shù)組再顯示;直接存字節(jié)數(shù)組可能還好一點;

插入的時候用帶參數(shù)的sql寫法比較好;用拼接sql一般會出錯;

測試表有三個字段,加載一個圖片然后插入記錄;

插入以后如下;第5、6條是對的,3、4沒插對;如果要png、jpeg、gif等格式都支持,寫為?image1.Save(ms, image1.RawFormat);

?

讀取并顯示如下;

?

插入記錄的代碼,

            Image image1;MemoryStream ms = new MemoryStream();byte[] arr1 = null; ;if (pictureBox1.Image != null){image1.Save(ms, image1.RawFormat);arr1 = new byte[ms.Length];ms.Position = 0;ms.Read(arr1, 0, (int)ms.Length);//pic1 = Convert.ToBase64String(arr1);}ms.Close();if (button1.Text == "添加"){if (textBox1.Text == ""){MessageBox.Show("名字不能為空!", "添加信息");return;}else{string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + Environment.CurrentDirectory + "\\mytest.mdb'";string query = "INSERT INTO testpic (a1, a2, ppp) VALUES (?,?,?)";using (OleDbConnection conn = new OleDbConnection(connectionString)){using (OleDbCommand cmd = new OleDbCommand(query, conn)){// 這里設(shè)置參數(shù)值,注意索引對應(yīng)你SQL語句中參數(shù)的位置cmd.Parameters.AddWithValue("?", textBox1.Text);cmd.Parameters.AddWithValue("?", textBox2.Text);cmd.Parameters.AddWithValue("?", arr1);conn.Open();int rowsAffected = cmd.ExecuteNonQuery();conn.Close();}}textBox1.Text = "";textBox2.Text = "";}}

讀取顯示圖片的代碼,

	private void button2_Click(object sender, EventArgs e){string sql1 = "select * from testpic where id = " + 6;byte[] buff = null;buff = achelp.GetBufferFromDB(sql1, "ppp");System.IO.MemoryStream picbuf = new System.IO.MemoryStream(buff);Image image = Image.FromStream(picbuf, true);picbuf.Close();pictureBox1.Image = image;}......//返回圖片byte[]public byte[] GetBufferFromDB(string strSql, string fieldname){byte[] buff = null;if (conn_str == null){return null;}try{ole_connection.Open();//打開連接if (ole_connection.State == ConnectionState.Closed){return null;}ole_command.CommandText = strSql;ole_command.Connection = ole_connection;ole_reader = ole_command.ExecuteReader(CommandBehavior.Default);if (ole_reader.Read()){buff = (byte[])ole_reader[fieldname];}ole_reader.Close();ole_reader.Dispose();}catch (System.Exception e){//Console.WriteLine(e.ToString());MessageBox.Show(e.Message);}finally{if (ole_connection.State != ConnectionState.Closed){ole_connection.Close();}}return buff;}

要先執(zhí)行ole_reader.Read(),然后才能取ole_reader[fieldname];
?

http://aloenet.com.cn/news/40466.html

相關(guān)文章:

  • java做網(wǎng)站用什么軟件新聞報道最新消息今天
  • 庫車建設(shè)工程信息網(wǎng)站seo查詢愛站網(wǎng)
  • 自動做任務(wù)賺錢的網(wǎng)站在百度怎么發(fā)布作品
  • 舟山市建設(shè)局網(wǎng)站網(wǎng)站設(shè)計優(yōu)化
  • 寧夏城鄉(xiāng)和住房建設(shè)廳網(wǎng)站網(wǎng)頁設(shè)計制作教程
  • 做網(wǎng)站的叫什么思耐什么網(wǎng)站都能進的瀏覽器
  • 做網(wǎng)站頁面對PS切圖搜索引擎優(yōu)化工具
  • Ngnix打開wordpressseo實訓(xùn)報告
  • 龍港網(wǎng)站建設(shè)網(wǎng)站營銷
  • wordpress slides book南寧哪里有seo推廣廠家
  • 網(wǎng)站備案很麻煩嗎數(shù)據(jù)網(wǎng)站
  • wordpress 本地 搭建整站優(yōu)化深圳
  • 91色做爰免費網(wǎng)站企業(yè)培訓(xùn)機構(gòu)排名
  • 鄭州哪些公司做網(wǎng)站比較好網(wǎng)站seo站群軟件
  • 淘寶聯(lián)盟怎么做自已的網(wǎng)站四川游戲seo整站優(yōu)化
  • 網(wǎng)上購物網(wǎng)站開發(fā)報價長沙網(wǎng)站推廣排名優(yōu)化
  • java 做的網(wǎng)站搜狗收錄提交
  • 應(yīng)聘網(wǎng)站開發(fā)題目競價托管外包服務(wù)
  • 網(wǎng)站下拉菜單seo公司北京
  • div css制作個人網(wǎng)站營銷策劃方案怎么寫
  • 網(wǎng)站注冊免費永久中國做網(wǎng)站的公司排名
  • 可以兼職做設(shè)計的網(wǎng)站深圳做網(wǎng)站的
  • 抖音seo排名系統(tǒng)公司影響seo排名的因素有哪些
  • 怎么樣做美術(shù)招生信息網(wǎng)站搜索引擎優(yōu)化目標
  • 石首做網(wǎng)站的公司愛站網(wǎng)官網(wǎng)關(guān)鍵詞
  • 增城微信網(wǎng)站建設(shè)公司網(wǎng)絡(luò)推廣營銷
  • 網(wǎng)站開發(fā)實用技術(shù)響應(yīng)式網(wǎng)站模板的特點
  • 30天網(wǎng)站建設(shè)網(wǎng)站訪問量查詢工具
  • wordpress gallery類型seo網(wǎng)站優(yōu)化推薦
  • 新洲建設(shè)局網(wǎng)站如何實施網(wǎng)站推廣