Hi Michael

My first exposure to <cfqueryparam.
Thanks for that.
Taking what you said caused I got the right result.

What you suggested did not work for me
because TranDataBinary is a varBinary(MAX)

If it had been varchar(MAX), that would have done it
cuz base64 converts binary to char representation.

This worked nicely:

<cffile action="READBINARY"
         file="#InPdfFullname#"
         variable="binPdf">
<cfquery name="updateTransfer" datasource="xxxxx#">
        UPDATE fmTransfer
           SET   TranDataBinary = (<cfqueryparam value='#binPdf#' 
cfsqltype="CF_SQL_BLOB">)
           WHERE TranFormId     = 'AAA158AC'
</cfquery>

Plus I now know about
  ToBase64()
  ToBinary()

Many thanks Michael

Archie



Michael E. Carluen wrote:
> Archie,
>
>
>   
>> <cffile action="READBINARY"
>>            file="#InPdfFullname#"
>>            variable="binPdf">
>>     
>
>
> >From here, convert to base64()
>
> <cfset tempvar = tobase64(binPdf)>
>
>
> Then insert as a blob
>
>   
>> <cfquery name="updateTransfer" datasource="xxxxxxx">
>>         UPDATE fmTransfer
>>             SET   TranDataBinary = (<cfqueryparam value="#tempvar#"
>>     
> cfsqltype="CF_SQL_BLOB">)
>   
>>            WHERE TranFormId     = 'AAA158AC'
>> </cfquery>
>>     
>
> HTH 
>
> Michael
>
>   
>> -----Original Message-----
>> From: Archie Campbell [mailto:[EMAIL PROTECTED]
>> Sent: Monday, December 04, 2006 7:03 PM
>> To: CF-Newbie
>> Subject: Re: HowTo store a PDF or JPEG file in a MS SQL 2005 database
>>
>> Bob Imperial wrote:
>>     
>>> Hi Archie,
>>>
>>> This is just me, but I don't store images or pdfs in a db, I generally
>>> upload both and store only image or pdf names in the db. Storing them in
>>>       
>> a
>>     
>>> db would produce a rather bloated db after a short while ;) Then I'll
>>> reference the directory I store them in using a variable name somewhere
>>> above my query, ie;
>>> <cfset imgDir="C:\wwwroot\mysite\images" /> then use the "imgDir" in my
>>> output, same with the pdf files. Not sure if this is what you were after
>>>       
>> but
>>     
>>> it works for me ;) HTH
>>>
>>>       
>> Yes, thanks for the thought Bob.
>> In addition to wanting to figure out how to get a PDF into a SQL data
>> field, I am also looking for alternatives.
>>
>> In this case the PDFs are small, around 25k, so it seems OK to keep them
>> in the database
>>
>>
>>     
>>> Bob
>>> ibe.cfm?user=20051.1733.15
>>>       
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:2302
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to