I known the way to display the mysql blob image in Windows Forms.
try
{
MySqlConnection connection = new MySqlConnection(hp.myConnStr);
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "select logo from mcs_institude where id = 1";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
pictureBox1.Image = new Bitmap(new MemoryStream((byte[])Reader.GetValue(0)));
}
connection.Close();
}
catch(Exception ex)
{
MessageBox.Show("Error in Get_ImageFormDB"+ ex.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
But now i doing a asp.net project. In this image not have the image property,.
command = connection.CreateCommand();
command.CommandText = "Select FO_Roomdet_Image from fo_roomtype where FO_Roomdet_Id=1";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
Image1.ImageUrl = new MemoryStream((byte[])Reader.GetValue(0));
}
connection.Close();
When i try this in asp.net, it through an error.
Error 1 Cannot implicitly convert type 'System.IO.MemoryStream' to 'string'
How Can i Solve this issue. and get mysql blob image just display in asp.net image control.
help me please.