0

ca you help me? I am looking for example how to insert and get data from BLOB in MS SQL Server 2008. I am using OLE DB and Visual C++. Thanks

1 Answer 1

1

There's detailed info on that topic (the write side anyway) here: Sending BLOB Data to SQL SERVER Using IROWSETFASTLOAD and ISEQUENTIALSTREAM.

Most of the available samples are too simplistic and don’t demonstrate varying data length per row or using ISequentialStream. In this sample, you'll see both techniques in one source file. By default, the sample shows how to use IRowsetFastLoad to send variable length BLOB data per row using in-line bindings. In this case, the in-line BLOB data must fit in available memory. This method has better performance when the BLOB data is a few bytes to a few MB, because there is no additional stream overhead. For larger data, especially where the data is not necessarily all available at once in a block, streaming is a better choice.

For readback there is background and sample code on MSDN here.

The SQL Server Native Client OLE DB provider does not retrieve large data from SQL Server until requested to do so by the consumer. The consumer should bind all short data in one accessor, and then use one or more temporary accessors to retrieve large data values as required.

Sign up to request clarification or add additional context in comments.

3 Comments

the article is really unreadable. it is formated terribly.. but i cant find no other example
If you cut and paste the code into VS it's easy to select and format it to improve readability. I agree it's not well laid out but the design advice (for write at least) is excellent.
I have found example project here: msftdpprodsamples.codeplex.com/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.