Wrox Programmer Forums
|
BOOK: Professional C#, 2nd and 3rd Editions
This is the forum to discuss the Wrox book Professional C#, 3rd Edition by Simon Robinson, Christian Nagel, Karli Watson, Jay Glynn, Morgan Skinner, Bill Evjen; ISBN: 9780764557590
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C#, 2nd and 3rd Editions 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 May 27th, 2004, 09:09 AM
Authorized User
 
Join Date: Apr 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ranakdinesh
Default IMAGE Data type

I have datafiled Photo with datatype Image in sql server . i want to use it to store Image. how i canwrite a code in windows Application using C# to insert and retrive image from the database to viev it on a Picture t control. please provide me few lines of sample code


dinesh Rana
__________________
dinesh Rana
 
Old May 29th, 2004, 12:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

Insure it will help u much.
http://www.codeproject.com/cs/database/albumviewer.asp

Always:),
Hovik Melkomian.
 
Old June 2nd, 2004, 05:42 AM
Authorized User
 
Join Date: Apr 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ranakdinesh
Default

what is the error in this code whenever i i run the code i recieve an error at Bitmap bmp = new Bitmap(stream);
as addtional inforamtion



string strcmd = string.Format("select photo from employee where employeeid = '1199'");
SqlCommand cmd =new SqlCommand(strcmd,conn);
byte[] b = (byte[])cmd.ExecuteScalar();
    if(b.Length > 0)
{

System.IO.MemoryStream stream = new System.IO.MemoryStream(b, true); stream.Write(b, 0, b.Length);

        Bitmap bmp = new Bitmap(stream);


                //if(bmp.Width>500 && bmp.Height >300)
                {
                // Bitmap bmp1 = new Bitmap(bmp,new Size(500,300));
                // photo.Image = bmp1;
                }
                //else
                {
                // photo.Image = bmp;
                }



            }
        conn.Close();
        }

dinesh Rana
 
Old June 2nd, 2004, 09:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

It works fine dear. Did u edited the codes?!
What is this?!
Code:
                //if(bmp.Width>500 && bmp.Height >300)
                {
                //    Bitmap bmp1 = new Bitmap(bmp,new Size(500,300));
                //    photo.Image = bmp1;
                }
                //else 
                { 
                //    photo.Image = bmp;
                }


Always:),
Hovik Melkomian.
 
Old June 3rd, 2004, 09:08 AM
Authorized User
 
Join Date: Apr 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ranakdinesh
Default

i inserted the photographs in the server sucess fully but when i want to retrive photographs back from the server it gives me an error
invalid arguments at


Bitmap bmp = new Bitmap(stream)
i tried it in number of ways but i wont get it.

Please help me to get out of this

dinesh Rana
 
Old June 5th, 2004, 12:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

I guess u miss a Reference. check the documentation again for that?!

Always:),
Hovik Melkomian.
 
Old March 18th, 2005, 08:35 AM
Registered User
 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I Need to create a table in which I have to add Image Datatype column.My environment is win 2000 and SQL server 2000.front end is VB.Net.I need this at the earliest.How to ad a .jpeg file into that table using blobs.
regards
ravi





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems in Image Data Type ayan.mukherjee VB Databases Basics 0 June 30th, 2008 03:54 AM
inserting image data type object MAKO SQL Server 2005 1 September 8th, 2006 04:44 PM
insert image in to oracle blob data type rajesh_bamane Pro VB Databases 3 July 15th, 2006 02:06 AM
How can INSERT Image into BLOB data type shah_shah Pro VB Databases 0 July 6th, 2006 03:51 AM
Data Type error but it is the correct type Mitch SQL Server 2000 2 March 19th, 2004 11:31 AM





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