Using SqlType Image or Binary without a file (Reading) RRS feed

  • Question


    I have a picture set in an SQL Database (SqlType.Image). Do I have to push the data to a file before I can use it or is there a way to use the data in the variable without a file? I want to set it into a PictureBox control or something similar. Due to the data the image contains its a security risk for us to have it in a file. We need the data to stay in memory if possible.


    Thanks for any help.

    Friday, November 30, 2007 10:56 PM


All replies

  • This is pure theory here but couldnt you do somthing like this ?


    PictureBox pb = new PictureBox();

    Bitmap bmp = new Bitmap(aRow["imageFieldName"] as Image);

    pb.Image = bmp;



    Friday, November 30, 2007 11:28 PM
  • You could also have a look at Image.FromStream to create Images from a (Memory)Stream instead of a file...
    Saturday, December 1, 2007 8:58 AM