Results 1 to 2 of 2

Thread: ADO.net - console app. to download pic (blog.file) from the Sql server database

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Location
    Chennai
    Posts
    8

    ADO.net - console app. to download pic (blog.file) from the Sql server database

    I looking for easier way to download some picture (type Image) from my central sqlserver database to my loca drive....I have a table with ImangeId, Description and the image itself...can I also use the same datareader for fetching the images ..or any other best options..

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: ADO.net - console app. to download pic (blog.file) from the Sql server database

    Images are retrieved from and stored to databases using byte arrays. This code is in VB.NET but can easily be converted to C#, either manually or using an online converter.

    Note that that code operates on a single field in a single record. If you use a DataReader or DataAdapter to get multiple records then each image field will contain a byte array and you use the same principle as demonstrated with each field value you want to convert to or from an Image object.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width