[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to display .jpg from Database on webpage

Posted on 2011-10-17
3
Medium Priority
?
308 Views
Last Modified: 2012-06-21
The Sql table contains a User row having a 'Logo' column representing a .jpg file.  
The logo column has a datatype of varbinary(MAX).

My webpage references the picture with: <asp:Image ID="imgLogo" runat="server" ImageUrl="CompanyLogo" />

That's where I'm stuck.

The User's Profile is an object called 'myProfile', thus the image can be referred to as myProfile.Logo

In the Page_Load event I need to set the variable CompanyLogo to myProfile.Logo


My overall question is how do I set the CompanyLogo variable to the varbinary(MAX) SQL column's contents.

I'm using Linq to Sql and Database I/O is performed in another tier, so at the time in question, the information is available,
I just don't understand how to implement it.


0
Comment
Question by:jackwebb22002
  • 2
3 Comments
 
LVL 7

Accepted Solution

by:
mozcullu earned 2000 total points
ID: 36979544
here is a good resource telling it all:

http://www.dotnetcurry.com/ShowArticle.aspx?ID=129
0
 
LVL 7

Expert Comment

by:mozcullu
ID: 36979558
instead of image data type in the article you can use varbinary(max)
0
 

Author Closing Comment

by:jackwebb22002
ID: 36980799
Thanks, but i don't need all the Sql IO.
And as I mentioned, I'm using Linq to Sql
So I settled on this:
http://stackoverflow.com/questions/1005565/how-to-retrieve-an-image-from-ms-sql-server-to-bind-in-gridview-asp-net-by-using
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question