Unlike any other data type, only binary data can not be written directly and you've to send them in time of statement execution. To allow this you must create object implementing the IDataValueEvents interface and pass a reference to it to the IDataValue.AsBinary property. Binary data will be written in blocks. The IDataValueEvents.BlockWrite will be invoked every time a next block is required. To indicate end of data, set the out argument Count to zero.
Some database drivers are very slow when you're sending larger binary data. E.g. MS Access driver works well until you want to send data over 1.5 MB, then it always wait at the end of data sending. There may be solution on some systems by specifying the size of data with IDataObject.SetBinarySize method. Some systems may even require doing it. To determinate if your system needs it, use IDataSource.DataSizeNeeded.
The long strings can be sent like binary data, but you must store them in UNICODE - i.e. double byte coded characters. Because some of ODBC drivers don't convert binary data to the string one, you should use IDataValue.BinaryIsString method to override this disability when necessary. Using this method to mark binary data as string doesn't produce error if driver support conversion.
Example How To Write Binary Data
For full source code see the File Backup demo.
type TMainForm = class(TForm, IDataValueEvents) protected FBuffer:packed array[0..cBufSize-1] of byte; . . . end; implementation procedure TMainForm.BlockWrite(const Sender: IDataValue; var Count: Integer; var Buffer: Pointer); begin blockread(f, FBuffer, cBufSize, Count); Buffer:=@FBuffer; ProgBar.Position:=round(100*filepos(f)/filesize(f)); if Count = 0 then begin ProgLabel.Caption:='Waiting for ODBC driver...'; ProgLabel.Refresh; KeepCancelAlive; end; end; procedure TMainForm.StartBtnClick(Sender: TObject); . . . AssignFile(f, s); Reset(f, 1); if ioresult = 0 then Params.AsBinary:=Self else continue; Execute; CloseFile(f); . . . end; end.