Hi guys! i wonder how can i save image path in a string to MySQL, i mean...what instruction i have to use...i want to save it to MySQL and then show it into a picture box. Thank you very much for your help.

Hi,
Get the path using opendialog control, then save the path to database.
When you want to show it, just load from database and show it using picture box.
Just it.

Sorry to bother you, but can you be more expecific? using and example please?

ok, i have this code:

If Text1 = KeyPress Then
Label = CommonDialog1.FileName
End If

but i have an error with KeyPress event :C

ok, i have this code:

If Text1 = KeyPress Then
Label = CommonDialog1.FileName
End If

but i have an error with KeyPress event :C

This not a code i asking for..
I asked your code for save or load data from database.
or you didn't have a code for save or load data?
and for your code how you can assign a textbox with keypress ? and you try to get file name without select it.

the code to save data is this:

With Adodc1
.Recordset.Save 'lo que tiene la tabla se va a guardarn
MsgBox "Los datos han sido guardados", vbInformation, "aviso"
.Refresh 'actulizar
.Recordset.Requery
End With

See if this help.
This following example code is how to save image path into mysql:

Button Browse used to select an image and show the path to lblPath.

Private Sub btnBrowse_Click()
CommonDialog1.Filter = "All files (*.*)|*.*"
CommonDialog1.DialogTitle = "Select File"
CommonDialog1.ShowOpen

lblPath.Caption = CommonDialog1.FileName ' label path to show path of image
End Sub

Button Save used to store data into database.

Private Sub btnSave_Click()
With Adodc1
    .Refresh
    .Recordset.AddNew
    .Recordset.Fields("IdAddress") = txtIdAddress.Text
    .Recordset.Fields("First_Name") = txtFirstName.Text
    .Recordset.Fields("Last_Name") = txtLastName.Text
    .Recordset.Fields("Phone_Num") = txtPhoneNumber.Text
    .Recordset.Fields("Email") = txtEmail.Text
    .Recordset.Fields("PhotoPath") = lblPath.Caption ' This field will save path of selected image from common dialog.
    .Recordset.Update
End With
    MsgBox "Data Added"
End Sub

Thank you very much for your help n.n
Do have any idea of how can i refresh the image when i pulse the botton new? this is the code i have:

With Adodc1
.CommandType = adCmdTable
.RecordSource = "exp" 'table's name
.Refresh
.Recordset.AddNew 'representa el nuevo dato a guardar
End With

the grid is refresh, but not the same with the image
Thanks a lot

Try this :

Set Picture1.Picture = Nothing

Don't forget to mark this thread as solved :)

Edited 5 Years Ago by Jx_Man: n/a

It works!! thank you very much for your help :)

So this thread is solved n_n

Edited 5 Years Ago by Shizuka: n/a

Your're Welcome..
Please Mark your thread as solved..
you can find the link below the posts.

This question has already been answered. Start a new discussion instead.