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

With rs

            .AddNew()
            .Fields("Nome").Value = txtName.Text
            .Fields("CAI").Value = txtCAI.Text
            .Fields("Empresa").Value = cbCompany.Text
            .Fields("Departamento").Value = txtDepartment.Text
            .Fields("Extensao").Value = txtPhone.Text
            .Fields("Passe").Value = txtPass.Text
            .Fields("Tipo").Value = cbTipo.Text
            .Fields("Marca").Value = txtMarca.Text
            .Fields("Modelo").Value = txtModelo.Text
            .Fields("Serie").Value = txtNSerie.Text
            .Fields("Data").Value = Date.Today

            .Update()
            .Requery()
            clear()
            rs.Close()
            Call Imagem()

        End With
        'Else
        With rs
            .Fields("Nome").Value = txtName.Text
            .Fields("CAi").Value = txtCAI.Text
            .Fields("Empresa").Value = cbCompany.Text
            .Fields("Departamento").Value = txtDepartment.Text
            .Fields("Extensao").Value = txtPhone.Text
            .Fields("Passe").Value = txtPass.Text
            .Fields("Tipo").Value = cbTipo.Text
            .Fields("Marca").Value = txtMarca.Text
            .Fields("Modelo").Value = txtModelo.Text
            .Fields("Serie").Value = txtNSerie.Text
            .Update()
        End With
        'End If
    End Sub

Guys I really need your help
its not home work
I'm just self teaching myself

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.

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.

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

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

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

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.