0

hey guys need a little help.
i tried to save image into my database, it saves without error
but when i tried to check if it saves in mysql, the data about my picture id save, but the image i save return a value of 0.
please help me with this.

here's my code...
-------------------------------------------------------------------------------------
myconn = New MySqlConnection(cons)
mycom = New MySqlCommand
Try
mycom = New MySqlCommand("insert into tblpic values('" & PicID.Text & "','" & PictureBox1.Dock & "')", myconn)
myconn.Open()
mycom.ExecuteNonQuery()
myconn.Close()
MsgBox("Record SAVED")

Catch ex As Exception
MessageBox.Show(ex.Message, "Database Failure!", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

------------------------------------------------------------------------------------

thanks in advance.(",)

2
Contributors
1
Reply
3
Views
8 Years
Discussion Span
Last Post by sknake
0

Please use code tags when posting code on daniweb:

[code=vb.net] ...code here...

[/code]

You can't very well insert a picture boxes .Dock state in to the database. You need to use parameters and a byte array. Do a quick google search on "parameterized SQL" and that should get you pointed in the right direction.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.