Store Images in a Database

Version
1.0

Image Insertion

I am giving you code snippets that show you how to handle those two methods. For inserting an image into database I have used an Image Control (let the name Image1). First Select an Image and put it into the Image1 control on the form, add a submit button, and write the following code:

rec.Open <database name>, con, adOpenKeyset, adLockOptimistic
rec.AddNew
Dim pp As New ADOPictDB32.ADOPictDB
Dim temp As String
temp = "picture.tmp"

If Image1.Picture <> 0 Then
 SavePicture Image1.Picture, temp
 pp.putPict rec, "pict", temp
Else
 Exit Sub
End If
rec.Update
rec.Close
Set rec = Nothing

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.” - Donald Knuth