944,073 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 1346
  • VB.NET RSS
Nov 4th, 2009
0

saving pictures to Access using ADO

Expand Post »
Hi Guys

please I need your help.

I'm creating this small application that will control some equipments based on its bar code and the owner picture.

everything is working fine, except the picture.

is there a way to save image to access database using ADO Connections and\or recordsets?
I've head its possible to store the path and the retrieve. does any body have a step by step tutorial?

I would really appreciate your quickest answer

Thank you

my app example
VB.NET Syntax (Toggle Plain Text)
  1.  
  2. With rs
  3.  
  4. .AddNew()
  5. .Fields("Nome").Value = txtName.Text
  6. .Fields("CAI").Value = txtCAI.Text
  7. .Fields("Empresa").Value = cbCompany.Text
  8. .Fields("Departamento").Value = txtDepartment.Text
  9. .Fields("Extensao").Value = txtPhone.Text
  10. .Fields("Passe").Value = txtPass.Text
  11. .Fields("Tipo").Value = cbTipo.Text
  12. .Fields("Marca").Value = txtMarca.Text
  13. .Fields("Modelo").Value = txtModelo.Text
  14. .Fields("Serie").Value = txtNSerie.Text
  15. .Fields("Data").Value = Date.Today
  16.  
  17. .Update()
  18. .Requery()
  19. clear()
  20. rs.Close()
  21. Call Imagem()
  22.  
  23. End With
  24. 'Else
  25. With rs
  26. .Fields("Nome").Value = txtName.Text
  27. .Fields("CAi").Value = txtCAI.Text
  28. .Fields("Empresa").Value = cbCompany.Text
  29. .Fields("Departamento").Value = txtDepartment.Text
  30. .Fields("Extensao").Value = txtPhone.Text
  31. .Fields("Passe").Value = txtPass.Text
  32. .Fields("Tipo").Value = cbTipo.Text
  33. .Fields("Marca").Value = txtMarca.Text
  34. .Fields("Modelo").Value = txtModelo.Text
  35. .Fields("Serie").Value = txtNSerie.Text
  36. .Update()
  37. End With
  38. 'End If
  39. End Sub
Last edited by Nick Evan; Nov 17th, 2009 at 5:46 pm. Reason: Add code-tags
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
Leodumbi is offline Offline
27 posts
since May 2009
Nov 17th, 2009
0
Re: saving pictures to Access using ADO
Guys I really need your help
its not home work
I'm just self teaching myself
Reputation Points: 10
Solved Threads: 0
Light Poster
Leodumbi is offline Offline
27 posts
since May 2009
Nov 17th, 2009
0
Re: saving pictures to Access using ADO
Saving pictures to a database isnt optimal and should be avoided if possible. Including pictures can greatly increase the size of your database and reduce the speed of its processing. Likewise everytime you update a record that contains a picture, even if your not touching the column with the picture, that record size is doubled in your db making it continue to grow.

It is much better to store the path of your picture in a database column and use that path to load your pictures when needed.
Reputation Points: 84
Solved Threads: 48
Posting Whiz
TomW is offline Offline
342 posts
since Sep 2009
Nov 18th, 2009
0
Re: saving pictures to Access using ADO
You don't want to store the image in the database.

Storing a file name is the same as any other text field. Nothing special about it.

Loading the image is as simple as setting the image property of whatever control you're using to display the picture to the file name.
Reputation Points: 10
Solved Threads: 2
Newbie Poster
lancebird is offline Offline
3 posts
since Nov 2009
Nov 19th, 2009
0
Re: saving pictures to Access using ADO
Ok
Now guys how can I save the path and then retrieve it in its respective field.

I would glad allready if youredirect me to a tutorial, a step by step instruction or even a private sub sample code.

cheers
Reputation Points: 10
Solved Threads: 0
Light Poster
Leodumbi is offline Offline
27 posts
since May 2009
Nov 19th, 2009
0
Re: saving pictures to Access using ADO
Leo, yes you can (and should) store the path and retrieve it and use that to load your images. To backtrack, you can upload pictures to the database (it is possible) but is a very bad practice to do so for reasons mentioned above. I'm glad you are reasonable enough to take the suggestions and opt to use a more efficient method.

As to your question, it is very general. What exactly do you need help with, creating a connection string, executing a query, loading the image?
Here is a link that will provide a lot of usefull examples for database programming from the MSDN:
Data Walkthroughs
Last edited by TomW; Nov 19th, 2009 at 10:03 am.
Reputation Points: 84
Solved Threads: 48
Posting Whiz
TomW is offline Offline
342 posts
since Sep 2009
Nov 30th, 2009
0
Re: saving pictures to Access using ADO
Hi TomW

What I meant is: I'm using vb 2005 and I'm not being able to save the image path into the database not display it in a textbox/label.

If I could do one of the two above I could for sure be able to retrieve the image.

so the main problem is "I cant Save Image Path Into database, not eve display it in a text box or label and the be saved"

thanks for your prompt answers, and please help.

Cheers
Reputation Points: 10
Solved Threads: 0
Light Poster
Leodumbi is offline Offline
27 posts
since May 2009
Jul 9th, 2010
0
Re: saving pictures to Access using ADO
Hi All

I managed to do what I wanted. this is what I wanted: (I hope to get some points )

as I said I was a self teaching person and I started a project that I wanted to save picture and some other details, a long with a registration # for each entry, and the entry # should the picture name.

thangs god and Google I did it, please give me some time to remove some details wich I thing must not be publishes and I will Post the entire sample code for you'all
Reputation Points: 10
Solved Threads: 0
Light Poster
Leodumbi is offline Offline
27 posts
since May 2009
Dec 11th, 2010
0
Re: saving pictures to Access using ADO
Hi guys

sorry the delay... So I figured it out on how to save and retrieve fotos.
I actually dont savethe photo it self. I user the Open or Save dialog.filename property and assign it to a label; the I save the label test

there you are try it.

Now its SOLVED
Reputation Points: 10
Solved Threads: 0
Light Poster
Leodumbi is offline Offline
27 posts
since May 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: In VB.Net: how to display tablenames/tables from a MySQL database in a listview
Next Thread in VB.NET Forum Timeline: "Tie" forms together?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC