Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 27th, 2004, 09:09 AM
Authorized User
 
Join Date: Apr 2004
Location: Gurgaon, Haryana, India.
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
  #2 (permalink)  
Old May 29th, 2004, 12:11 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
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.
  #3 (permalink)  
Old June 2nd, 2004, 05:42 AM
Authorized User
 
Join Date: Apr 2004
Location: Gurgaon, Haryana, India.
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
  #4 (permalink)  
Old June 2nd, 2004, 09:21 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
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.
  #5 (permalink)  
Old June 3rd, 2004, 09:08 AM
Authorized User
 
Join Date: Apr 2004
Location: Gurgaon, Haryana, India.
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
  #6 (permalink)  
Old June 5th, 2004, 12:23 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
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.
  #7 (permalink)  
Old March 18th, 2005, 08:35 AM
Registered User
 
Join Date: Mar 2005
Location: bangalore, karnataka, India.
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.