I would like to know whats wrong with this code, because when I retrieve the image it gives me an error message saying:
"Connection must be valid and open."
'Send sql query to retrieve information about the employees
sqlConn = "SELECT Description, Price, Maker, Color, Items, Store_Available, Serial_number, Sales_number, Picture from `mayombe_mdcs`.`shoesinstore` where Serial_number = @serial"
objDataAdapter = New MySqlDataAdapter(sqlConn, objConn)
objDataAdapter.SelectCommand.Parameters.AddWithValue("@serial", strSerial)
Dim pictureData As Byte() = DirectCast(cmd.ExecuteScalar(), Byte())
Dim picture As Image = Nothing
'Create a stream in memory containing the bytes that comprise the image.
Using stream As New IO.MemoryStream(pictureData)
'Read the stream and create an Image object from the data.
PictureBox1.Image = Image.FromStream(stream)
End Using
'Fill the form with retrieved informations
objDataAdapter.Fill(objDataset)