Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Displaying Images on a page

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
hplayer03 - 14 Aug 2007 20:06 GMT
I am trying to create an asp.net 2.0 site that has the paths of images
stored in a sql database.  I am able to connect to the database and
extract the paths.  I am stuck now because i would like to dynamically
create images and set their paths to those that i find in the
database....here is the code to get the path names:

string connSTR =
ConfigurationManager.ConnectionStrings["DatabaseConnectionString"].ConnectionString.ToString();
           SqlConnection conn = new SqlConnection(connSTR);
           SqlDataAdapter a = new SqlDataAdapter("SELECT path, name,
description FROM Pics;", conn);
           DataSet s = new DataSet();
           a.Fill(s);
           string sImagePath = "";
           foreach (DataRow dr in s.Tables[0].Rows)
           {
               sImagePath = dr[0].ToString() + dr[1].ToString();
           }
Alexey Smirnov - 14 Aug 2007 20:45 GMT
> I am trying to create an asp.net 2.0 site that has the paths of images
> stored in a sql database.  I am able to connect to the database and
[quoted text clipped - 14 lines]
>                 sImagePath = dr[0].ToString() + dr[1].ToString();
>             }

Try to use DataList or GridView. Otherwise you can simply

Panel1.Controls.Add(new LiteralControl("<img src.... "));

or

Response.Write("<img src....");

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.