Wie anzeigen, mysql blob Bild in asp.net Bild-Steuerelement?

Ich gewusst, dass die Möglichkeit zum anzeigen der mysql blob Bild 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);
            }

Aber jetzt habe ich dabei ein asp.net Projekt. In dieses Bild nicht die image-Eigenschaft.

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();

Wenn ich versuche diese in asp.net es durch einen Fehler.

Fehler 1 kann Nicht implizit konvertiert Typ 'System.IO.MemoryStream' zu
'string'

Wie Kann ich dieses Problem Lösen. und bekommen, mysql blob Bild nur Anzeige in asp.net Bild-Steuerelement.

mir bitte helfen.

InformationsquelleAutor Sagotharan | 2012-10-04
Schreibe einen Kommentar