Results 1 to 9 of 9

Thread: how to store and retrieve an image to an sql image field

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2012
    Location
    Dammam, Saudi Arabia
    Posts
    74

    Question how to store and retrieve an image to an sql image field

    Hi All,

    I want to store an image to SQL Server 2005. I don't wan't to store the image path, i wanna store the image as it is. If anybody has an idead please share it with me.

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Re: how to store and retrieve an image to an sql image field

    Have a look at this which is from RhinoBull, it is in Access but it should be usable with SQL Server also.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2012
    Location
    Dammam, Saudi Arabia
    Posts
    74

    Re: how to store and retrieve an image to an sql image field

    Thanks for the reply dee-u.
    But i've a question. in that eg u used OLE Data as datatype to store the image. In SQL what Datatype should i use for this. And, if i use image or varbinary(MAX) datatype will this work correctly?

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Re: how to store and retrieve an image to an sql image field

    Yes, I believe that is what you should use in SQL Server now.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: how to store and retrieve an image to an sql image field

    Don't say "SQL" if you mean "SQL Server" since nearly every RDBMS uses SQL queries.

    From the MSDN Library CD (online Help) that comes with VB6:

    Intermediate Microsoft Jet SQL for Access 2000
    The OLEOBJECT data types

    The OLEOBJECT data types are used to store large binary objects such as Word documents or Excel spreadsheets. The number of bytes is not specified, and the maximum size is 2.14 gigabytes. Its synonyms are IMAGE, LONGBINARY, GENERAL, and OLEOBJECT.
    I can't find a table mapping Jet data types to SQL Server data types right now but the odds are very good that you have chosen the right type.

  6. #6
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: how to store and retrieve an image to an sql image field

    According to this: http://technet.microsoft.com/en-us/l.../cc917602.aspx the equivalent to 'OLE Object' in Access is 'Image' in SQL Server. (as Dilettante's Post suggests)

  7. #7
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,123

    Re: how to store and retrieve an image to an sql image field

    Quote Originally Posted by Doogle View Post
    According to this: http://technet.microsoft.com/en-us/l.../cc917602.aspx the equivalent to 'OLE Object' in Access is 'Image' in SQL Server. (as Dilettante's Post suggests)
    According to MSDN, image data types will be removed in a future version of Microsoft SQL Server so its safer to use varbinary(MAX).
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  8. #8
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: how to store and retrieve an image to an sql image field

    That's good of them ! I should have noted the Date on the link I posted (2004).

    So all those poor souls who heeded the 'advice' in 2004 are going to be stuffed if / when they want to migrate to a future version of SQL Server. Do Microsoft have any idea of how the real world works?

    I'm struggling to think why they'd ever want to remove a data type once it's been established - is there some sort of major overhead in 'supporting' it from their point of view?

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: how to store and retrieve an image to an sql image field

    I'm guessing some of those "types" are just source-level synonyms for each other anyway just as in Jet.

    The odds of the deprecated synonyms actually going away is probably small. Still, you never know. Microsoft isn't the company it used to be.

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