0
 string constring = "server=localhost;uid=root;" + "pwd=12345;database=products;";
            string query = "SELECT prd_items_image FROM products.prd_items where prd_items_id=5";
            MySqlConnection condatabase = new MySqlConnection(constring);
            MySqlCommand cmddatabase = new MySqlCommand(query, condatabase);
            MySqlDataReader myreader;
            try
            {
                condatabase.Open();
                myreader = cmddatabase.ExecuteReader();
                while (myreader.Read())
                {
                    byte[] imgg = (byte[])(myreader["prd_items_image"]);
                    if (imgg == null)
                        box.Image = null;
                    else
                    {
                        MemoryStream mstream = new MemoryStream(imgg);
                       box.Image = System.Drawing.Image.FromStream(mstream);
                    }
                }

I am getting error at if condition,

box.Image=null andbox.Image = System.Drawing.Image.FromStream(mstream);

In these two cases, I am getting error at Image. So please check it once. If you have any other code ,provide me if required.

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
  • Error 'System.Windows.Controls.Image' does not contain a definition for 'Image' and no extension method 'Image' accepting a first argument of type 'System.Windows.Controls.Image' could be found (are you missing a using directive or an assembly reference?) – user2395948 Jul 26 '13 at 11:04
  • I got the above error in my console... – user2395948 Jul 26 '13 at 11:04
  • 1
    Have you ever had a look into the documentation of the [WPF Image control](http://msdn.microsoft.com/en-us/library/system.windows.controls.image.aspx)? You might have realized that it has no `Image` property, but that the appropriate property is called `Source`. Then you might also have realized that you can't assig `Source` from a `System.Drawing.Image`, as that is not WPF. – Clemens Jul 26 '13 at 11:17
  • plz tell me the code for that.......... – user2395948 Jul 26 '13 at 11:21
  • See [here](http://stackoverflow.com/a/14337202/1136211). Assign the result to `box.Source`. – Clemens Jul 26 '13 at 11:45

0 Answers0