i hve crete information application...

i using this code to save employee information into accessdatabase

If _contactIC = 0 Then

                sql = "insert into employee_table (firstname,lastname,ic,address,gender,phone,status)" & "values ('" & firstname.Text & "','" & lastname.Text & "','" & em_id.Text & "','" & em_address.Text & "','" & em_gender.Text & "','" & em_phone.Text & "','" & em_status.Text & "')"


                Dim Command As New OleDbCommand(sql, conn)
                Command.ExecuteNonQuery()

                conn.Close()

                MessageBox.Show("employee Registration Complete.", "MESEJ", MessageBoxButtons.OK)

i use this code to upload picture into folder

Private myFolder As String = "C:\employeepic\" '// added just once and easy to edit if needed.
Private mySettingsFile As String = myFolder & "employee.txt" 

 Dim myCoolOpenFileDialog As New OpenFileDialog
        With myCoolOpenFileDialog
            .Title = "Please select only a Cool image to use... :D" '// a cool little title for the OpenFileDialog.
            .CheckFileExists = True
            .Filter = "All Files|*.*|Bitmap Files (*)|*.bmp;*.gif;*.jpg;*.png"
            .FilterIndex = 2 '// select the 2nd Filter.
            If .ShowDialog = DialogResult.OK Then
                Dim sNewImageFullPath As String = myFolder & IO.Path.GetFileName(.FileName) '// set String once.
                '// copy image first.
                If IO.File.Exists(.FileName) = True Then '// check if file exists by using the FullPath of the file.
                    IO.File.Copy(.FileName, sNewImageFullPath, True) '/ keep FullPath of image for saving to file.
                    '//--- IO.File.Copy(SourcePath, DestinationPath, Overwrite)
                    '//---- IO.Path.GetFileName(.FileName) only gets the FileName and Extension of a file and not the FullPath like when using only ".FileName".
                    '// use copied image path instead of original path.  reason: deleting original image after being loaded, will not be allowed.
                    PictureBox3.Image = Image.FromFile(sNewImageFullPath) '// Load image.
                    '==========================================================
                    '// you were setting the .Tag to the "Original" file path and not your newly copied one.
                    PictureBox3.Tag = sNewImageFullPath
                    '==========================================================
                    MsgBox("File Upload and Set Successfuly.")
                End If
            End If
        End With

ID is primary key to update info or anything else..I using Listview to view all employee info using this code

Private Sub Loader()

        ListView.Items.Clear()
        While (myDR.Read())
            With ListView.Items.Add(myDR("product"))
                .SubItems.Add(myDR("model"))
                .SubItems.Add(myDR("stockIn"))
                .SubItems.Add(myDR("dateIn"))
                .SubItems.Add(myDR("stockOut"))
                .SubItems.Add(myDR("allQuantity"))
                .SubItems.Add(myDR("dateOut"))
                .SubItems.Add(myDR("ID"))

            End With

        End While

but can i save picture into folder that can be retrive based ID on number ?

You need to store the path of the file stored in the folders along with other details in the employee table.

To retrieve the same yo need to fetch the path stored in the DB and read the file from file systems.

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.