Hi,
I'm a beginer in c sharp and I can't pass over a problem. I would like to bind a blob field (mysql) with a picturebox in c sharp;
here is the code:
I'm a beginer in c sharp and I can't pass over a problem. I would like to bind a blob field (mysql) with a picturebox in c sharp;
here is the code:
- string query = "Select name,director,picture from Movies where Movies.name='" + search + "'";
- //create command and assign the query and connection from the constructor
- MySqlCommand cmd = new MySqlCommand(query, connection);
- //Execute command
- MySqlDataReader dr;
- dr = cmd.ExecuteReader();
- if (dr.HasRows)
- {
- while (dr.Read())
- {
- txtname.Text = (dr["Name"] + "");
- txtdirector.Text = (dr["Director"] + "");
- txtactors.Text = (dr["Actors"] + " "");
- }
- }
- else
- MessageBox.Show("The movie is unavailable");
What shall I do to extract the picture form database and put it in a picturebox
like I put the other fields in textbox ? If anybody know, I would like an exact answer not a link,
because I use mysql not sql and because I already done a lot of searching on this topic bu
without succes.
thank you in advance
Florentin IzvoranuPosted May 13, 2010, 6:59 AM
but if I want to save the picture in folder how I can take them from database? as string, as I did with the other info (txtname.Text = (dr["Name"] + "");) ? and the how i put in in the picture box?
picture.Image = Image.FromFile(@"???");
CrishPosted May 13, 2010, 6:43 AM
R u saving picture in database or in folder ?
If folder then it's good for performance. You just only need to save image name to database and save image to folder. You will easily get and bind on page.