NP.  You might want to consider changing TranDataBinary into a blob datatype
for better support.

Anyway, as Bob mentioned earlier, he and probably a good number of
developers still prefer storing files in a file directory, as there are
advantages and disadvantages for using either technique.  Probably you can
do a poll on a different thread to find out the general consensus in the
community- if you want to find out.



> -----Original Message-----
> From: Archie Campbell [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 04, 2006 8:30 PM
> To: CF-Newbie
> Subject: Re: HowTo store a PDF or JPEG file in a MS SQL 2005 database
> 
> 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


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:2303
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