I have 9 image paths for a product database I'm working on. I'd like to set their values from the database to each picture box.

I've already configured MySQL to localhost and can connect.

        string connStr = "server=localhost;user=root;database=possystem;port=3306;password=mypass";
        MySqlConnection conn = new MySqlConnection(connStr);
            string sql = "SELECT prodimg FROM Products";
            MySqlCommand cmd = new MySqlCommand(sql, conn);
            MySqlDataReader rdr = cmd.ExecuteReader();
            while (rdr.Read())
            { //Some code

        catch (Exception ex)

1 Answers

E. Mamaghani On

First of all this is not good idea to store image path in database! Second, specify that if your images paths are URL (From web) or just local.

If you are working with URL, get the URL from database & use Load method. (Resource):

.Load(string url);

If you are loading images from a local storage use:

Picturebox.Image = New Bitmap("Image Path");