Quantcast
Channel: Visual COBOL
Viewing all articles
Browse latest Browse all 5819

Forum Post: RE: Save image to sql.

$
0
0
I have used the attached method with succes a while ago (1 Gb of pictures) The ReadAllBytes does the read (very fast !!) Succes, Jan Vink -------------------------------------------------------------------------------------------------------------------       01 inpmap-record   pic x(250) value 'C:\Pictures\image9.jpg'.       01 input-document-data type System.Byte[].         method-id  get-a-foto       * ==================================       * Get complete image for insert       * inpmap-record contains the complete path\filename if the image       * ==================================            invoke type System.IO.File::ReadAllBytes(inpmap-record) RETURNING input-document-data.       * Test for errors with Try / Catch       * Now you can insert the image of the file (or word doc etc..) into the database       * Using MS-SQL-server insert statement to insert the image       *       * where the database field 'foto' is defined as :'[image] NULL,'          set foto to input-document-data.       * Insert into statement         end method.

Viewing all articles
Browse latest Browse all 5819

Trending Articles