Monday, October 6, 2008

Retrieve Image from SQL Server C#

Last time, I have posted the code in saving image to SQL Server in C#. Today I'm going to write the code in retrieving the image from SQL Server.

// fetch data from database
// Create dataTableAdapters

adapter.Fill(dataSet, "table");
MemorySystem ms = new MemorySystem;

dataSet.table[0].Image_Data, 0, dataSet.table[0].Image_Data.Length);
Image bmp = Bitmap.FromStream(ms);
pictureBox1.Image = bmp;

No comments: