Image to SqlServer in C#

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adam Goetz

    #1

    Image to SqlServer in C#

    I had a look and couldn't find what I was after under google, so I'll ask
    here.

    I want to know how to take an image from a Picture Box (how the image gets
    there is irrelevant) and save it in a SQL table. I have found example for
    doing it from a file stream in VB.Net, but not a picturebox and I don't have
    the knowledge of C# objects to know which ones to use for this task.
    If this fails, I will try saving the image, then using a filestream to read
    it back in in order to use the example I have found, but that is double
    handling and I would prefer not to have to save the image to disk.


  • Ignacio Machin

    #2
    Re: Image to SqlServer in C#

    Hi,

    You could save it to a memory stream instead of a FileStream, but I think
    that using a stream to save it to is the only solution


    --
    Hope this help,

    --
    Ignacio Machin,
    ignacio.machin AT dot.state.fl.us
    Florida Department Of Transportation

    "Adam Goetz" <adam.goetz@ayr data.com> wrote in message
    news:uCLiLHjgDH A.2748@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I had a look and couldn't find what I was after under google, so I'll ask
    > here.
    >
    > I want to know how to take an image from a Picture Box (how the image gets
    > there is irrelevant) and save it in a SQL table. I have found example for
    > doing it from a file stream in VB.Net, but not a picturebox and I don't[/color]
    have[color=blue]
    > the knowledge of C# objects to know which ones to use for this task.
    > If this fails, I will try saving the image, then using a filestream to[/color]
    read[color=blue]
    > it back in in order to use the example I have found, but that is double
    > handling and I would prefer not to have to save the image to disk.
    >
    >[/color]


    Comment

    Working...