954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Add Image to mySQL from vb.net

hi. how can i save image file in mySQL from vb.net?
my vb.net program picture
the image i want to save in mySQL database is already in the picture box
mySQL table
and this is my SQL tables now how can i add the image in the picture box to mySQL

"Insert into brgyemployee (PICTURE) values ('"PictureBox1.Image"')"

dont work :(

note: brgyemployee is the name of my table where "PICTURE" column is located

frotek
Newbie Poster
2 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

or atleast to fix this code

Imports MySql.Data.MySqlClient
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim con As New MySqlConnection()
        Dim cmd As New MySqlCommand
        Dim adptr As New MySqlDataAdapter
        Dim table As Image
        con.ConnectionString = "SERVER=localhost;UID=root;PWD=israel;DATABASE=testing"
        adptr = New MySqlDataAdapter("SELECT PICTURE FROM brgyemployee WHERE Fname= '" & TextBox1.Text & "'", con)
        adptr.Fill(table)
        Dim i As Integer
        PictureBox1.Image = PictureBox1.Image & "" & table.Rows(i)("PICTURE")
    End Sub
End Class


underlined codes gives me errors, this one is for loading the image from database in
PictureBox1.Image

frotek
Newbie Poster
2 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: