0

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.

2
Contributors
14
Replies
17
Views
6 Years
Discussion Span
Last Post by Jx_Man
0

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.

0

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

0

ok, i have this code:

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

but i have an error with KeyPress event :C

0

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.

0

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

0

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
0

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

0

Try this :

Set Picture1.Picture = Nothing

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

Edited by Jx_Man: n/a

0

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

So this thread is solved n_n

Edited by Shizuka: n/a

0

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.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.