DataSet ds = bll.GetList("");
byte[] MyData= new byte[0];
int PicCount = 0;
if (ds.Tables[0].Rows.Count < 5)
{
PicCount = ds.Tables[0].Rows.Count;
}
else
{
PicCount = 5;
}
for (int i = 1; i <= PicCount;i++ )
{
DataRow myRow = ds.Tables[0].Rows[i-1];
if (myRow["Image"].ToString() != " ")
{
MyData = (byte[])myRow["Image"];
int ArraySize = new int();
ArraySize = MyData.GetUpperBound(0);
string address = Server.MapPath("temp");
System.IO.File.Delete(address + @"\" + i.ToString() + ".jpg ");
FileStream fs = new FileStream(address + @"\" + i.ToString() + ".jpg ", FileMode.OpenOrCreate, FileAccess.Write);
fs.Write(MyData, 0, ArraySize);
fs.Close();
im_Photo1.Visible = true;
}
else
{
im_Photo1.Visible = false;
}
((Label)FindControl("lb_picture_title" + i)).Text = myRow["Titel"].ToString();
((Label)FindControl("lb_picture_content" + i)).Text = myRow["Content"].ToString();
}