saving pictures to Access using ADO

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2009
Posts: 5
Reputation: Leodumbi is an unknown quantity at this point 
Solved Threads: 0
Leodumbi Leodumbi is offline Offline
Newbie Poster

saving pictures to Access using ADO

 
0
  #1
Nov 4th, 2009
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
  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 niek_e; 31 Days Ago at 5:46 pm. Reason: Add code-tags
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 5
Reputation: Leodumbi is an unknown quantity at this point 
Solved Threads: 0
Leodumbi Leodumbi is offline Offline
Newbie Poster
 
0
  #2
32 Days Ago
Guys I really need your help
its not home work
I'm just self teaching myself
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 320
Reputation: TomW is on a distinguished road 
Solved Threads: 45
TomW TomW is offline Offline
Posting Whiz
 
0
  #3
32 Days Ago
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 3
Reputation: lancebird is an unknown quantity at this point 
Solved Threads: 1
lancebird lancebird is offline Offline
Newbie Poster
 
0
  #4
31 Days Ago
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.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 5
Reputation: Leodumbi is an unknown quantity at this point 
Solved Threads: 0
Leodumbi Leodumbi is offline Offline
Newbie Poster
 
0
  #5
30 Days Ago
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 320
Reputation: TomW is on a distinguished road 
Solved Threads: 45
TomW TomW is offline Offline
Posting Whiz
 
0
  #6
30 Days Ago
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; 30 Days Ago at 10:03 am.
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 5
Reputation: Leodumbi is an unknown quantity at this point 
Solved Threads: 0
Leodumbi Leodumbi is offline Offline
Newbie Poster
 
0
  #7
19 Days Ago
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
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC