如何在Asp.net C#中的图像标记中显示图像

时间:2016-05-12 11:29:19

标签: c# asp.net

我已尝试使用此代码显示图片标记中的图片但未显示图片帮助我

SqlCommand cmd = new SqlCommand();
cmd.CommandText = "Select Image From tablename";
cmd.Connection = Connection.con;
Connection.con.Open();

byte[] bytes = (byte[])cmd.ExecuteScalar();
string strbasestring = Convert.ToBase64String(bytes);
imgsubcon1.ImageUrl = "data:Image/png;base64," + strbasestring;
Connection.con.Close();

0 个答案:

没有答案