i am a new user of visual studio 2008

i make a database program, but i cant save the image in access data base, i also want that image save a copy file in database.

any one help me.

Use OLE field (column) type to store the content of file.

Consider a table named "TestTable" has two fields - filename (Text), filecontent(OLE).

Use Oledb provider classes,

Dim mbytes() As Byte = System.IO.File.ReadAllBytes("c:\myfile.gif")
  Dim cn As New OleDbConnection("your_connection_string")
  Dim cmd As New OleDbCommand("insert into TestTable values (@filename,@filecontent)", cn)
  cmd.Parameters.Add("@filename", OleDbType.VarChar, 30).Value = "myfile"

  cmd.Parameters.Add("@filecontent", OleDbType.Binary, mbytes.Length).Value = mbytes

 cn.Open()
 cmd.ExecuteNonQuery()
 cn.Close()
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.