Link to home
Start Free TrialLog in
Avatar of SweetsJamRock
SweetsJamRockFlag for Jamaica

asked on

how do i save an image to a table using c#

Hey Guys,

  I AM DOING A DESKTOP APPLICATION

i am stUck with a problem.  i have develope A major application and i can not seem to
 be able to save a picture from a picture box object to my table  using c#

I just need the syntax.  
 
    example:  if i am saving  from a textbox object to a table i would use this syntax
 
        myanswer=textbox1.text;

  i need the syntax to be as simple as that if possible

 
SOLUTION
Avatar of nishant joshi
nishant joshi
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hi,

if the DB type for the image column is blob you can convert the image object to a byte array and insert it to the DB.

E.g: http://www.codeproject.com/KB/aspnet/ImageInDatabase.aspx 
Avatar of SweetsJamRock

ASKER

guys i am using sql 2008, there is no "BLOB" type in there.  however i see bit, so i will try that.  I had also check the both areas that was sent to me via link.  

i need some more help guys.  i can't have my application stuck because of this 1 problem.

oh! - also i am not interested in saving the path in the table ONLY the picture (image).  

the user must be able to change the picture any time and resave picture changes.

thanks anyway
guys i have seen many ways of doing this thing but i want you guys to take a look at what i have and see
 
   this is a screen of a picture i want to save after i have retrieved the image

 


THIS IS THE METHOD THAT SELECT THE PICTURE


 THIS IS THE SYNTAX THAT WOULD HAVE SENT D IMAGE TO THE TABLE OF IT WAS correct.

This is the ONLY problem

  contextdbobject.tablename.insertonsubmit(sldl);
  contextdboject.submitchanges();
 User generated image
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial