Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 3rd, 2007, 12:29 AM
Registered User
 
Join Date: Jun 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to cholletivinod
Default Displaying Image in a gridview

hi sir,
 i am displaying image in gridview ,initially i am inserting image in data base ,it works fine but when i am trying to display it in grid ,here problem comes ,how can i pass Id of image ,why v cant do it using only one pages

here is my code :

 SqlConnection cn = new SqlConnection("Data Source=KLINFOIT2;Initial Catalog=Vinod;Integrated Security=True");
            cn.Open();
            DataSet ds = new DataSet();
            byte[] arrContent;
            DataRow dr;
            string strSql;
            strSql = "SELECT img_data FROM Image Where img_pk=20";
            SqlDataAdapter da = new SqlDataAdapter(strSql, cn);
            da.Fill(ds);
            dr = ds.Tables[0].Rows[0];
            arrContent = ((byte[])dr.ItemArray["img_data"]);
            string conType = dr.ItemArray["img_contenttype"].ToString();
            Response.ContentType = conType;
            Response.OutputStream.Write(arrContent, 0, (Byte[])dr.Item["imgLength"]);
            Response.End();


Please rep





Vinod





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying images in gridview using code takwirira ASP.NET 2.0 Basics 2 May 23rd, 2008 06:28 AM
Image not displaying shoakat ASP.NET 2.0 Professional 2 June 22nd, 2007 10:02 AM
array displaying as image vinodkokane Visual C++ 1 April 23rd, 2007 12:06 AM
gridview not displaying sarah lee ASP.NET 2.0 Basics 5 December 30th, 2006 05:28 AM
displaying an image from file stream into an image sanjeet ADO.NET 0 September 23rd, 2005 10:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.