Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-10

Adding blob data to MSSQL database

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Richard Mace

Hi All,
I am using the native components that come with Lazarus and can successfully connect and retrieve data from a MSSQL database. However, I am now needing to add data to the database, and have read many examples of adding strings or integer's to the database, but I can't find any with an example of adding blob data.
Would somebody mind showing me an example of code that would do this?

Many thanks

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20131004/63fcd5c0/attachment.html>

Reply by email

Reinier Olislagers
to Richard Mace
Richard Mace wrote 6 lines
I am using the native components that come with Lazarus and can successfully connect and retrieve data from a MSSQL database. However, I am now needing to add data to the database, and have read many examples of adding strings or integer's to the database, but I can't find any with an example of adding blob data. Would somebody mind showing me an example of code that would do this?

For BLOBs stored in files
TBlobField(FData.Fields[1]).LoadFromFile('blobfield.bin'); should work. There's also LoadFromStream and in FPC trunk, you can use e.g. .AsBytes to assign a byte array.

BTW, for mssqlconn, as documented in the readme and the FPC documentation, it's useful to set this parameter:
<yourconnection>.Params.Add('TEXTSIZE=2147483647'); //Large (>16 MB) blob support

Reply by email