DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Tue, 14 Aug 2007 19:06:00 -0000,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    hplayer03
          2    Alexey Smirnov


Displaying Images on a page   
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();
            }
Date:Tue, 14 Aug 2007 19:06:00 -0000   Author:  

Re: Displaying Images on a page   
On Aug 14, 9:06 pm, hplayer03  wrote:

> 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"].Connecti­onString.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();
>             }


Try to use DataList or GridView. Otherwise you can simply

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

or

Response.Write("<img src....");
Date:Tue, 14 Aug 2007 12:45:40 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us