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

讀取資料庫圖片

發布時間: 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;

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

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

熱點內容
深入編譯器 發布:2025-05-15 07:41:35 瀏覽:877
電信手機號服務密碼怎麼查 發布:2025-05-15 07:40:10 瀏覽:613
python全局變數文件 發布:2025-05-15 07:35:06 瀏覽:954
位元組和存儲位元組 發布:2025-05-15 07:32:10 瀏覽:521
linux應用開發工程師 發布:2025-05-15 07:32:07 瀏覽:261
sqldcl 發布:2025-05-15 07:29:18 瀏覽:199
canvas的圖像上傳 發布:2025-05-15 07:29:17 瀏覽:102
離線緩存為什麼點不動 發布:2025-05-15 07:27:17 瀏覽:829
釘鼎伺服器出口ip 發布:2025-05-15 07:13:08 瀏覽:279
移動硬碟和光碟哪個存儲時間長 發布:2025-05-15 07:04:25 瀏覽:489