cancel
Showing results for 
Search instead for 
Did you mean: 

A novice question

Former Member
0 Kudos

I have a blob column in a data window, OLEdatabaseBLOB, that enables me to retrieve, update, and store an MS Word doc.  If I hard code the key value in the key clause, works fine.  If I switch to a variable (e.g., :job_id), it doesn't resolve.  The SQL shows the key value as "?", null.  So here's the dumb question, how do I pass a value to the variable in the key clause?  I've tried doing it several ways through the data window arguments but to no avail.

James

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi James;

  This is super easy with the DW OLE Column mapping and yes, a little tricky if you have not done this before. I'll walk you through it - here are the steps I use:

1) Create a Table with a blob column defined inside it.

    Here is what I am using for this walk through (SQLAnyWhere - Long Binary column)  ... 

2) Create a new DW and set a Retrieval Argument on the key column, as follows:

    -  ID =>  :ID in my example ...

3) Add an OLE Column to your new DWO, as follows:

4) Map the OLE Column to the DB Table Blob column, as follows:

5) Chris's Trick ... User won't see any OLE on Row Insert!

   Thus, use this tip ... add a picture, place in back, slide behind OLE space:

6) Actual test ...

   - Insert new row

   - Double-Click icon

   - Add MS-Word text

   - File=>Close&Return   (menu)

Last but not least, select the SAVE option in the DW Painter. Update () of course in your PB code.

HTH

Regards ... Chris

Former Member
0 Kudos

Hi Chris,

thanks for your helpful guidance through this.

After trying out I realized (you marked it with very important), that the retrieval argument has to have the same name than the primary key.

In your example for the key clause id = :id this is shown.

If you name the retrieval argument e.g. 'isid', then retrieving the BLOB (with where clause id = :isid) brought me up an error. Seems not to be logical for me, but worked only in this way.

Regards

Bernhard

Former Member
0 Kudos

Hi Bernard;

  Yes, another little "quirk" of the OLE DW. 

As I 1st mentioned .. this technique is easy but has a few tricks to it - LOL!

Regards ... Chris

Former Member
0 Kudos

Many thanks Chris, I would never have gotten this, didn't put the connection together that the key name had to match the argument name.  I think I spent two whole days trying to make this work with other alternatives.

Thanks again

Former Member
0 Kudos

Hi James;

  Excellent news & you are most welcome!  

Reminds me of a great TV commercial slogan ... "An educated consumer is out best customer"!    

Regards ... Chris

PS: Good luck on the rest of your PB project!

Answers (1)

Answers (1)

arnd_schmidt
Active Contributor
0 Kudos

A question mark is shown when the DisableBind database parameter is not set.

But this does not mean that your SQL will fail.

Take a look at the your PowerBuilder help for further informations.

SyBooks Online (Archive) - DisableBind

SyBooks Online (Archive) - SQL Preview

hth

Arnd