Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, Im a newbie and still exploring the endless range of VB.NET 2010... I am using VB.Net, does anyone out there who can suggest a code (best)in storing a image to ACCESS (.mdb)?

Requirments:
1. Best data type to handle this data "in VB"
2. Best data type to handle this data "ACCES" (ofcourse the one with the
smallest file size since im concern that this type of data engulfs large
amounts of its storage)
3. Of course the sample code in VB, I used the following code in setting the
connection:
VB
Imports System.Data.OleDb

Public Class dbs
    Public Shared Function Connect() As OleDbConnection

        Dim db As New OleDbConnection
        db.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0;" _
            & "DATA SOURCE = " & Application.StartupPath &
           "\Database\Vault.mdb"

        Return db

    End Function

End Class


And I use the following code at any time to connect and open to the database
VB
Imports System.Data.OleDb

Public Class name

    Private db As OleDbConnection
    db = dbs.Connect
    db.Open()
    'code here... assuming pbPictureBoxName as the PictureBox
    db.Close()
End Class

I would appreciate all the help you give at me guys, chow!
Posted
Updated 31-Mar-12 5:06am
v2

1 solution

Images can be stored in following different ways:
1- Store them as byte array
2- store the physical path of the image where its actually stored
3- store as OLE object.

I prefer storing images as byte array if my owns the storage of the images. Following links would provide you the details you are looking for:

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/38fca0cc-e012-4934-ad8b-2f95c4e26cc4/

http://www.dreamincode.net/forums/topic/74114-a-really-simple-database/[^]

hope it helps.
 
Share this answer
 
Comments
Jhenanne 1-Apr-12 4:05am    
Thanks prdshukla, it really helps alot.
Pradeep Shukla 1-Apr-12 10:03am    
welcome...mark it as an answer if it solves your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900