Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi friends,
saving image to sql server field with image type is ok,
now how could I load this image to a control such as image control in asp.net ( in runtime ! )
I use this code in WinForm and it works:

C#
cmd.CommandText = "SELECT image FROM table1 where id='U07WL'";
cmd.CommandType = CommandType.Text;
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
byte[] barrImg = (byte[])reader["image"];
string strfn = Convert.ToString(DateTime.Now.ToFileTime());
FileStream fs = new FileStream(strfn, FileMode.CreateNew, FileAccess.Write);
fs.Write(barrImg, 0, barrImg.Length);
fs.Flush();
fs.Close();
panel1.BackgroundImage = Image.FromFile(strfn);

but in asp.net we don't have backgroundImage property, instead we have ImageUrl for example ! is there any way !?

excuse my bad explanation and bad english,
thanks in advande
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900