STORING /LOADING IMAGES FROM ACCESS DATABASE / SQL SERVER 
Author Message
 STORING /LOADING IMAGES FROM ACCESS DATABASE / SQL SERVER

does anybody knows how to store images in access database or SQL
Server for that matter, i really need that badly... please reply....


Wed, 29 Sep 2004 02:06:13 GMT  
 STORING /LOADING IMAGES FROM ACCESS DATABASE / SQL SERVER
Assume you have a VB program to let user select image file by its file name.
You can use ADO to connectto database (SQL Server, here)

With ADO 2.5 or older, you use AppendChunk() method to save binary data into
a table (the field type is Image, usually), with ADO 2.6 or later, it is
more easier to user ADO's Stream object to do this:

Dim rs as New ADO.RecordSet
Dim ste AS New ADO.Stream

'Assume you have a table, tblImage, with three columns: ID(AutoNumber),
FileName(String), MyImage(Image)
rs.Open "Select * From tblImage Where ID=0", MyConnection,adOpenKeySet,
adLockOptimistic
'Use Where ID=0 to make sure an empty recordset is opened

stm.Type=adTypeBinary
stm.Open
stm.LoadFromFile "c:\temp\MyImage.gif"

rs.AddNew
rs!FileName="MyImage.gif"
rs!MyImage=stm.Read

rs.Update

rs.Close
stm.Close

Set rs=Nothing
Set stm=Nothing

Now the image is saved into database.

HTH

Norm


Quote:
> does anybody knows how to store images in access database or SQL
> Server for that matter, i really need that badly... please reply....



Wed, 29 Sep 2004 02:21:38 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. storing images inside sql server 7/2000 database

2. Storing Images OR Paths in SQL server database

3. Storing and displaying images in a SQL Server database

4. How to store image into SQL Server database?

5. Storing and displaying images in a SQL Server database

6. Store the image in picture box control into the image data type in SQL server

7. storing bit-map image (bmp or jpg) on SQL Server

8. Problem to store image in SQL server 6.0 with VB 4

9. Storing and Retrieving Images in SQL Server

10. Storing Images in Sql Server & V.B

11. Storing Images in Sql Server & V.B

12. Images stored on SQL Server

 

 
Powered by phpBB® Forum Software