I'd like to know if you have any way to make it work here
int chck = 0;
int fid = 0;
while (chck < 150)
{
try
{
sqlcon.Open();
string sql2 = "SELECT img FROM clienteimg WHERE ((clienteid = '" + cid + "') AND (id = '" + fid + "'))";
SqlCommand cmd2 = new SqlCommand(sql2, sqlcon);
SqlDataReader dr2 = cmd2.ExecuteReader();
dr2.Read();
byte[] imgLoc = (byte[])dr2[0];
sqlcon.Close();
MemoryStream mstream = new MemoryStream(imgLoc);
pb1.Image = Image.FromStream(mstream);
}
catch (Exception)
{
sqlcon.Close();
sqlcon.Open();
string foid = "9";
string sql3 = "SELECT img FROM ClienteImgDB WHERE id = '" + foid + "'";
SqlCommand cmd3 = new SqlCommand(sql3, sqlcon);
SqlDataReader dr3 = cmd3.ExecuteReader();
dr3.Read();
byte[] imgLoc = (byte[])dr3[0];
sqlcon.Close();
MemoryStream mstream = new MemoryStream(imgLoc);
pb1.Image = Image.FromStream(mstream);
}
chck++;
fid++;
}
int chck = 0;
int fid = 0;
while (chck < 150)
{
try
{
sqlcon.Open();
string sql2 = "SELECT img FROM clienteimg WHERE ((clienteid = '" + cid + "') AND (id = '" + fid + "'))";
SqlCommand cmd2 = new SqlCommand(sql2, sqlcon);
SqlDataReader dr2 = cmd2.ExecuteReader();
dr2.Read();
byte[] imgLoc = (byte[])dr2[0];
sqlcon.Close();
MemoryStream mstream = new MemoryStream(imgLoc);
pb'"+fid+"'.Image = Image.FromStream(mstream);
}
catch (Exception)
{
sqlcon.Close();
sqlcon.Open();
string foid = "9";
string sql3 = "SELECT img FROM ClienteImgDB WHERE id = '" + foid + "'";
SqlCommand cmd3 = new SqlCommand(sql3, sqlcon);
SqlDataReader dr3 = cmd3.ExecuteReader();
dr3.Read();
byte[] imgLoc = (byte[])dr3[0];
sqlcon.Close();
MemoryStream mstream = new MemoryStream(imgLoc);
pb'"+fid+"'.Image = Image.FromStream(mstream);
}
chck++;
fid++;
}
For every time I loop the "pb" add 1 more to fill the 150 pictureboxes I have