VB.Net Save image from VB.net into MySQL Database

Hey guys,

How would I go about using MySQL in VB.Net to save to an external MySQL database?

Thanks,
Jessee
LetsgetcodingAsked:
Who is Participating?
 
Asim NazirConnect With a Mentor Commented:
Use oledb with my sql provider to save the image to the db using mysql oledb provider, odbc, or use the managed ado.net one.  The example below should be simular for all of them


MySQL Connectors
http://www.mysql.com/products/connector/


    Public Sub SaveImage(ByVal imageData As Byte())
        Using con As New OleDb.OleDbConnection("connectionString")
            Using cmd As New OleDb.OleDbCommand("Insert into images ( image ) values ( ? )", con)
                cmd.Parameters.AddWithValue("image", imageData)
                con.Open()
                cmd.ExecuteNonQuery()
                con.Close()
            End Using
        End Using
    End Sub

0
 
Asim NazirCommented:
You want to save image to MySql db right?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.