Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 October 4th, 2006, 03:16 PM
Authorized User
 
Join Date: Sep 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Retrieving and Uplaoding Images in Database

Hi,

I have a hyperlink column named change bound to a datagrid. In the datagrid I have 5 rows and 5 columns. I have a row named logo in which i will dsplay the images from database in an order and when i click the change button corresponding to the first row, it should be directed to a new popup window in which i have to dislay the corresponding logo of the first row in an image window and when i click browse and upload a new logo from the db the new logo should be displayed in the image window of the popup menu. i have done upto file uploading in popup but i dont know how to retrieve the image from the database and upload another image to db. my question is if we have to retrieve the image from the database do we have to create a new connection in the new window where the popup is created or we have to connect from the parent window (in which the datagrid is displayed). Pls provide me with a solution.

Thanx
Vijay
 
Old October 5th, 2006, 02:07 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

To save the logo to database. TypeCast it to byte[]. Declare a columen in sql server of type image like Tab1(picid int primary key, pic image)
Now MyCommand.Commandtext="insert into Tab1(@pd,@pc)"
MyCommand.Parameter.Add("@pd",TextBox1.Text);
MyCommand.Parameter.Add("@pc",dbtype.Image,<yourby teArray>);
Similarly you can retrive image in byte[] like
byte[] img;
-----;
MyCommand.CommandText="Select pic from Tab1";
-----;
img=MyCommand.ExecuteReader();
-----;
MemoryStream strm;
strm.Read(img,0,0);
---;
Output.write(strm);




Bijgupt





Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieving images from database in asp.net pages sweetyrathore ASP.NET 1.x and 2.0 Application Design 3 March 25th, 2012 04:29 AM
Retrieving and Uploading Images in Database vijay_83 ASP.NET 2.0 Professional 1 October 4th, 2006 03:25 PM
Retrieving and Uplaoding Images in DataBase vijay_83 ASP.NET 1.0 and 1.1 Basics 1 October 4th, 2006 03:24 PM
Retrieving Images from SQL Server jazzcatone ASP.NET 1.0 and 1.1 Professional 1 September 19th, 2006 11:33 AM
uploading, retrieving images kourosh Classic ASP Basics 2 September 17th, 2005 04:33 PM





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