Inserting JPG into LONG RAW with ODAC
Posted: Sat 28 Jan 2006 13:35
I am migrating from ADO to ODAC in delphi 6
I am trying to insert JPG picture as stream into LONG RAW field on oracle 7.3
When i use the code i used with ADO i get warning "Not enough input parameters". Insert finishes succesfully but the picture is not inserted into the database.
I would not like to change the field type on the database, so i wonder what should i do to insert the picture using ODAC.
my ADO code looks like this:
BMP:=TBitMap.Create;
try
BMP:=image1.Picture.Bitmap;
jpg := TJPEGImage.Create;
jpg.CompressionQuality := 90;
Jpg.Assign (BMP);
stream := TMemoryStream.create;
jpg.saveToStream(stream);
finally
jpg.Free;
end;
oraQuery.SQL.Text := 'insert into MYTABLE (LONG_RAW_FIELD) '+
' values (:pPICTURE)';
oraQuery.ParamByName('pPICTURE').LoadFromStream(stream,ftBlob);
oraQuery.ExecSQL;
I am trying to insert JPG picture as stream into LONG RAW field on oracle 7.3
When i use the code i used with ADO i get warning "Not enough input parameters". Insert finishes succesfully but the picture is not inserted into the database.
I would not like to change the field type on the database, so i wonder what should i do to insert the picture using ODAC.
my ADO code looks like this:
BMP:=TBitMap.Create;
try
BMP:=image1.Picture.Bitmap;
jpg := TJPEGImage.Create;
jpg.CompressionQuality := 90;
Jpg.Assign (BMP);
stream := TMemoryStream.create;
jpg.saveToStream(stream);
finally
jpg.Free;
end;
oraQuery.SQL.Text := 'insert into MYTABLE (LONG_RAW_FIELD) '+
' values (:pPICTURE)';
oraQuery.ParamByName('pPICTURE').LoadFromStream(stream,ftBlob);
oraQuery.ExecSQL;