[英]How can I get image from SQL via C#?
我有一個表格,里面有關於社會中每個人的信息。
在這種形式中,有一個必須從SQL服務器生成的映像 。 我不知道如何使用根據CODE顯示圖像的存儲過程在圖像控件中生成此圖像Fromm sql到c#。 我在ASP(c#)的應用程序中工作
這是我在sql中的程序:
create proc uploadImage
@ppr int
as
if exists (select idimg from Images where idimg = ( select codeimg from Agent where PPR=@ppr))
begin
select image from Images where idimg = ( select codeimg from Agent where PPR=@ppr)
end
我已經有了我的代碼,但還沒有完成:
try
{
c.cmd = c.cn.CreateCommand();
c.cmd.CommandText = "uploadImage";
c.cmd.CommandType = CommandType.StoredProcedure;
if (c.cn.State == ConnectionState.Closed)
{
c.cn.Open();
}
c.cmd.Parameters.Add("@ppr", SqlDbType.Int);
c.cmd.Parameters["@ppr"].Value = Session["Code"];
SqlDataReader dr = c.cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
**// here where i will treat my image ..i think**
}
dr.Close();
}
我認為他的正確方法是:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.