Save .jpg picture through a query 
Author Message
 Save .jpg picture through a query

Hi,

This is probably a very easy question, but I need a solution
fast!

How do I store a .jpg picture file in a MSAccess 97 database

from my VB6 program? And how do I read it?
Is it possible to do that with a query, that is called like
this:

-=-=-=-=-=-=-=-=-

Public gWorkSpace As Workspace
Public gDatabase As Database
Public gQueryDef As QueryDef
Public gRecordSet As Recordset
Public gSQL As String

   Set gWorkSpace = DBEngine.CreateWorkspace( _
      "CassCD", _
      "admin", _
      "", _
      dbUseJet)
   Set gDatabase = gWorkSpace.OpenDatabase( _
      gsDataDir & gsDatabase, _
      False, _
      False, _
      ";PWD=" & strPassWord)

Set gQueryDef = gDatabase.QueryDefs("Count")
gQueryDef!parSource = 0         ' parSource defines sort of
records
Set gRecordSet = gQueryDef.OpenRecordset(dbOpenForwardOnly)
giTotalCD = gRecordSet(0)

-=-=-=-=-=-=-=-

Thanx,
Richard



Mon, 20 May 2002 03:00:00 GMT  
 Save .jpg picture through a query
You will need to use the AppendChunk method to store the image into a blob
(binary) field.  I did this a year or so ago and I recall that I had to
strip off some {*filter*}from the top of file when retrieving the file from the
database using GetChunk.  Access puts some header info into the file.  The
Microsoft KB has an article about how to write a DLL in VB that will trim
off the header info.  As I recall there were some bugs in the article's code
that you will have to work around.

Cheers
Rob



Quote:
> Hi,

> This is probably a very easy question, but I need a solution
> fast!

> How do I store a .jpg picture file in a MSAccess 97 database

> from my VB6 program? And how do I read it?
> Is it possible to do that with a query, that is called like
> this:

> -=-=-=-=-=-=-=-=-

> Public gWorkSpace As Workspace
> Public gDatabase As Database
> Public gQueryDef As QueryDef
> Public gRecordSet As Recordset
> Public gSQL As String

>    Set gWorkSpace = DBEngine.CreateWorkspace( _
>       "CassCD", _
>       "admin", _
>       "", _
>       dbUseJet)
>    Set gDatabase = gWorkSpace.OpenDatabase( _
>       gsDataDir & gsDatabase, _
>       False, _
>       False, _
>       ";PWD=" & strPassWord)

> Set gQueryDef = gDatabase.QueryDefs("Count")
> gQueryDef!parSource = 0         ' parSource defines sort of
> records
> Set gRecordSet = gQueryDef.OpenRecordset(dbOpenForwardOnly)
> giTotalCD = gRecordSet(0)

> -=-=-=-=-=-=-=-

> Thanx,
> Richard



Mon, 20 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB5 Saving Picture as GIF or JPG - How?

2. Saving Picture Box Contents as a JPG or GIF

3. Saving JPG Pictures

4. Saving a jpg picture in VB 5.0 using code

5. saving a picture as gif or jpg

6. Saving JPG picture file

7. Save picture in jpg format

8. Save a picture as jpg using VB6...

9. Save picture as jpg

10. save a picture as jpg using Vb6...

11. Saving a Picture Box in JPG or GIF format

12. How to save a Picture in JPG-format

 

 
Powered by phpBB® Forum Software