Jump to content
Sign in to follow this  

SQL-Save Image Into Out of a SQL Database.

Recommended Posts


Well I have had a looong week,

Using the code below I can insert an image into a database but I can't seem to figure out how to get it out.

$sqlCon = ObjCreate("ADODB.Connection")
$sqlCon.Open("Provider=SQLOLEDB; _
              Data Source=; _
              User ID=testuser; _
$sqlCon.execute("INSERT INTO MS_Patches(ScreenShots) Values ('d:\ScreenShot1.jpg')")

After I run this and I look at the database with a GUI Database manager all I see in the ScreenShots column in the new row is |||||||||. I think this is right, from what I am reading online you can't see the image until you save it out of the database which is what I am having problems with. I can retrieve text information from other Columns but How would I go about saving the Image file.

Thanks for any assistance,


Share this post

Link to post
Share on other sites

Well, I think I figured out what the issue is. when I read the data back from the SQL database it is "Streamed as Binary Data" Which I then must convert and save as a file. I don't know how to do this in AutoIT or even if it's possible but I found a good example for VB6 so I am going to be brushing the dust off my VB6 and trying to do at least the Database querys from VB. The adding info into the database I still plan on doing with AutoIT.

Share this post

Link to post
Share on other sites

Just to throw a tip from my database days...

You do not want to store any types of pictures in a database. You need to always have them linked. It will bloat your database so large that it will become hard to move around.

What you want to do is put all of your pictures in a folder, and link them in your database.


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.