简体   繁体   中英

How to save TByteDynArray object to SQL Server varbinary(MAX) column?

I am having TByteDynArray object that represents some binary data (file) that I want to store to MS SQL Server database table in varbinary(MAX) column. How can I do it?

I am using C++ Builder XE7 and ADO components and would like to avoid using TADOTable since it would force me to load the entire table.

First you have to create a ADO stream object with your data.

http://www.w3schools.com/asp/ado_ref_stream.asp

Then using ADO "connection->execute" command, insert the stream object into respective table and column using SQL "INSERT" statement.

如果使用的是TADOQuery ,则可以Insert()一行中Insert()Edit() ,然后为该行中的所需字段调用CreateBlobStream()方法,然后将字节写入提供的TStream对象。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM