Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Getting the text encoded value of a jpg file...

Reply
Thread Tools

Getting the text encoded value of a jpg file...

 
 
Charlie@CBFC
Guest
Posts: n/a
 
      02-08-2007
Hi:

I want to set a default value of a varbinary(max) column in SQL Server. The
reason is my application databinds to a varbinary(max) column to display
pictures, and if there is no picture when record is created, I would like it
to default to a common picture. To do this, I will need text encoded
equivalent of binary file so I can paste it in as a column default. How do
I do this?

Thanks,
Charlie


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      02-08-2007
do a hex dump of the image. then use this syntax:

insert table (@id, 0xfffffffffff)




Charlie@CBFC wrote:
> Hi:
>
> I want to set a default value of a varbinary(max) column in SQL Server. The
> reason is my application databinds to a varbinary(max) column to display
> pictures, and if there is no picture when record is created, I would like it
> to default to a common picture. To do this, I will need text encoded
> equivalent of binary file so I can paste it in as a column default. How do
> I do this?
>
> Thanks,
> Charlie
>
>

 
Reply With Quote
 
 
 
 
manit77@gmail.com
Guest
Posts: n/a
 
      02-09-2007
On Feb 8, 7:47 am, "Charlie@CBFC" <(E-Mail Removed)> wrote:
> Hi:
>
> I want to set a default value of a varbinary(max) column in SQL Server. The
> reason is my application databinds to a varbinary(max) column to display
> pictures, and if there is no picture when record is created, I would like it
> to default to a common picture. To do this, I will need text encoded
> equivalent of binary file so I can paste it in as a column default. How do
> I do this?
>
> Thanks,
> Charlie


Why don't you upload the default file to your database and have it as
ID of 0. Then in control the insert of the default image in your SP,
if the jpg is dbnull then do an insert of the default file you have
you in your database.

if( @filedata is null)

select @imagedata=data from files where id=0


insert into files(imagedata) values(@imagedata)



- Manit
http://www.acriticsreview.com

 
Reply With Quote
 
Charlie@CBFC
Guest
Posts: n/a
 
      02-09-2007
Thanks guys. I downloaded a hex editor to get at the code.

Used it in SP. Works great.

"bruce barker" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> do a hex dump of the image. then use this syntax:
>
> insert table (@id, 0xfffffffffff)
>
>
>
>
> Charlie@CBFC wrote:
>> Hi:
>>
>> I want to set a default value of a varbinary(max) column in SQL Server.
>> The reason is my application databinds to a varbinary(max) column to
>> display pictures, and if there is no picture when record is created, I
>> would like it to default to a common picture. To do this, I will need
>> text encoded equivalent of binary file so I can paste it in as a column
>> default. How do I do this?
>>
>> Thanks,
>> Charlie



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView header column text getting html encoded TS ASP .Net 4 07-05-2007 01:40 PM
JPG's were nor recognised as JPG's Matthias HTML 5 06-01-2004 11:50 AM
Wrong image size of JPG after TIFF to JPG conversion with JAI Roland Java 0 05-12-2004 03:52 PM
Looking for software to combine 4 JPG images into one JPG image G.M. Durrence Digital Photography 4 04-08-2004 08:04 PM
DSCN1234.JPG vs dscn1234.jpg on COOLPIX 885 Michel Boivin, ing. Digital Photography 0 12-26-2003 06:22 PM



Advertisments