Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to bind variables to blob fields using ADO and C++

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-07-19 : 07:05:12
Oleg writes "Dear SQL Team,
there are many acticles on the subject of how to read/write blobs in/to SQL Server, but in my case it doesn't work. I have C++ application that I need to modify to add binary data to tables.

According to all description all I need to do (to add a record with blob data )is:
1) open table
2) Use recordset to navigate through and then get correspondent field object from recordset and do AppendChunk.

What to do if I use other scenarios ?

To execute statement "INSERT INTO <my table name> values ( <my values list >)" to the tabe that contains field of the type "image" (it does not contain any image in fact, but some binary data about 10-20k in size) there is a call

m_pRecordset->Open(CommandText,_variant_t((IDispatch *)m_pConnection) , CursorType, LockType, Option);

First problem:

it is not clear how can I indicate that I want to bind my variable with image-type field. In the SQL Server Books online:
---
To write a long column, the application executes an INSERT or UPDATE statement with a parameter marker (?) in the place of the value to be placed in the ntext, text, or image column.
---
What is this (?) marker ? I do not suplay fields list for INSERT statement thus I have to use "null" in place of binary field.

Second problem:

Well, it inserts a record, but when I try next to get field object to call AppendChunk, no fields are available. How to whom can I ask for AppendChunk ?

This is in fact the simplest case. It seems more confusing in the case of more complex SQL statement when I need to insert/update records in one table from another one.

Any suggestions ?
Thank you,
Oleg."
   

- Advertisement -