當前位置:首頁 » 操作系統 » 讀取資料庫圖片

讀取資料庫圖片

發布時間: 2022-12-14 03:19:07

① C#如何讀取資料庫中所有的圖片顯示到對應的pictureBox中

privatevoidShowImage(stringsql)
{
//調用方法如:ShowImage("='"+userno+"'");
SqlCommandcmd=newSqlCommand(sql,conn);
conn.Open();
byte[]b=(byte[])cmd.ExecuteScalar();
if(b.Length〉0)
{
MemoryStreamstream=newMemoryStream(b,true);
stream.Write(b,0,b.Length);
pictureBox1.Image=newBitmap(stream);
stream.Close();
}
conn.Close();
}

類似這樣 根據你的實際情況修改。

② 怎樣從資料庫讀取圖片

把圖片路徑寫入資料庫,然後直接從裡面讀取圖片的路徑地址就好了。

③ 資料庫以img存儲,如何讀取圖片

直接使用企業管理器好像沒有辦法操作吧,通過軟體或自己做個小軟體讀取。

#region //讀取資料庫中圖片到內存.並顯示
public void LoadToMemoryAndDisable(string serverAdress, string database)
{
//讀取資料庫中圖片到內存.並顯示
SqlConnection conn = new SqlConnection("server=" + serverAdress + ";integrated security = sspi;database = " + database);
SqlCommand cmd = new SqlCommand("select * from imgtable where imgname like '%bmp%'", conn);
conn.Open();
SqlDataReader dr;
try
{
dr = cmd.ExecuteReader();
dr.Read();
System.Data.SqlTypes.SqlBinary sb = dr.GetSqlBinary(2);
//或byte[] imageData = (byte[])dr[2];
MemoryStream ms = new MemoryStream(sb.Value);//在內存中操作圖片數據
Bitmap bmp = new Bitmap(Bitmap.FromStream(ms));
this.pictureBox1.Image = bmp;
dr.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
}
#endregion

④ 怎麼讀取資料庫中的圖片

確保你的圖片已經保存到資料庫,如果沒什麼錯誤,那就看下面 showming.asp '連接資料庫 <% id=clng(trim(request("id"))) if id="" then response.End response.Expires=0 response.buffer=true response.Clear() set rs=server.CreateObject("adodb.recordset") sql="select * from proct where proctid="&id&"" rs.open sql,conn,3,1 response.ContentType="image/*" response.BinaryWrite rs("photo") rs.close set rs=nothing conn.close set conn=nothing %> 顯示的圖片的頁面:picshow.asp <img src="showimg.asp?id=<%=rs(" proctid")%=>" width="400" height="300" border="0" alt="這是一張圖片" >

⑤ 如何才能往資料庫里讀取圖片數據或者從資料庫里讀圖片能告訴我具體步驟嗎謝謝

具體步驟:
1.連接資料庫
2.查詢資料庫
3.調用資料庫中的圖片(有些是按照地址保存,有的是按照二進制保存)
在調用的地方用<img src="<%=rs("存放圖片的欄位")%>">
這樣就可以了

php中如何從資料庫中讀取圖片

比較普遍的方法是通過代碼實現。

⑦ ACCESS資料庫圖片讀取問題

圖片存入資料庫沒問題,讀出來就有問題了,不是簡單直接讀出二進制就可以,你還有告訴系統讀出來後的文件名後綴名,系統才會安裝圖片格式給你顯示。網上有很多圖片存入資料庫的源碼例子,你看下就明白了。

⑧ mysql資料庫讀取圖片

讀出二進制,轉化成流,然後write到頁面上 byte[] blob = userinfo.getPhoto(); if(blob!=null){ response.reset(); response.setContentType("image/"+dat);

⑨ delphi中,怎麼從access資料庫中讀取圖片

用delphi可以這樣
procere TFrm_Ls_cx.TBut_RefreshClick(Sender: TObject);
var Picms:TMemoryStream;
Picjpg:TJPEGImage;
begin
if ADOQ_List.FieldByName('pct').AsVariant <>'' then
Begin
Picms:=TMemoryStream.Create ;
Picjpg:=TJPEGImage.Create ;
TBlobField(ADOQ_List.FieldByName('pct')).SaveToStream(Picms);
Picms.Position :=0;
Picjpg.LoadFromStream(Picms);
img_pic.Picture.Assign(Picjpg);
PicJpg.Free;
Picms.Free;
End;
End;

⑩ 如何才能往資料庫里讀取圖片數據或者從資料庫里讀圖片

王大偉,這題我不要了,你隨意認證,任意拒絕,我已舉報。

熱點內容
伺服器改id是什麼 發布:2025-07-01 10:30:03 瀏覽:609
php微信開發教程 發布:2025-07-01 10:28:24 瀏覽:840
訪問學者聯系導師 發布:2025-07-01 10:27:44 瀏覽:982
伺服器端的http地址 發布:2025-07-01 10:04:35 瀏覽:176
php好處 發布:2025-07-01 10:01:45 瀏覽:877
安卓車機什麼屏幕好 發布:2025-07-01 09:46:15 瀏覽:547
編譯原理re不能描述的串 發布:2025-07-01 09:34:24 瀏覽:75
本地電腦怎麼用伺服器ip 發布:2025-07-01 09:10:03 瀏覽:831
有趣的python代碼 發布:2025-07-01 09:10:02 瀏覽:362
威龍奇兵ftp 發布:2025-07-01 09:07:38 瀏覽:694