"Umar" <me************@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
hi
i am trying to store images in sql database in binary form .. i do it
.... but when i want to show that stored images on my web form any
where i got only first 16 bytes of the image. so i got error and cant
display the image. but can store it successfully.
plz help me and guide me its urgent
thanx
DataSet DST = new DataSet("MyPic");
byte[] Arr = new byte[0];
DataRow DRow;
SqlDataAdapter SDA = new SqlDataAdapter(SQLappend, Conn);
SqlCommandBuilder CBuild = new SqlCommandBuilder(SDA);
SDA.Fill(DST, "MyPic");
try
{
DRow = DST.Tables["MyPic"].Rows[0];
Arr = (byte[])DRow["ColumnWithPic"];
int ArraySize = new int();
ArraySize = Arr.GetUpperBound(0);
FileStream FStream = new FileStream(@"c:\MyPic.bmp",
FileMode.OpenOrCreate, FileAccess.Write);
FStream.Write(Arr, 0, ArraySize);
FStream.Close();FStream.Dispose();DRow.Delete();
}