Saving image in database

saving image in sql database

Page 1 of 1

1 Replies - 1260 Views - Last Post: 03 March 2009 - 12:13 AM Rate Topic: -----

#1 Karanam UshaRani   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 02-March 09

Saving image in database

Post icon  Posted 02 March 2009 - 11:58 PM

what is the data type to store the image in sql database and sqlsever database and how can we retrieve that
Is This A Good Question/Topic? 0
  • +

Replies To: Saving image in database

#2 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1659
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Saving image in database

Posted 03 March 2009 - 12:13 AM

The data type would be IMAGE (SQL 2000) or VARBINARY(MAX) (SQL 2005). As for the code to save and retrieve you're going to need to show us what you've tried thus far, we're not just going to give you the required code. I can tell you that the image will need to be converted to a byte array, then saved into the database table. To retrieve and display the image you're going to need to retrieve the data, convert it into a byte array, then pass it to a MemoryStream, then create the image from the stream

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1