-
-
-
SqlConnection con = new SqlConnection(@"Data Source=ttt-PC;Initial Catalog=Query_Image;Integrated Security=True");
-
SqlCommand cmdnew = new SqlCommand("select pic from Image_Category where IMG_Cat='" + searchvalue.ToString() + "'", con);
-
con.Open();
-
// SqlDataReader dr = cmdnew.ExecuteReader();
-
SqlDataAdapter da = new SqlDataAdapter(cmdnew);
-
DataSet ds = new DataSet("Image_Category");
-
byte[] mydata = new byte[0];
-
da.Fill(ds, "Image_Category");
-
DataRow myrow;
-
//if (dr.HasRows)
-
//{
-
// while (dr.Read())
-
// {
-
-
for (int i = 0; i < 2; i++)
-
-
// while (i <= dt.Rows.Count)
-
-
{
-
-
myrow= ds.Tables["Image_Category"].Rows[i];
-
mydata = (byte[])ds.Tables[0].Rows[i]["pic"];
-
str[i]=new MemoryStream(mydata);
-
-
pbx[i]=new PictureBox();
-
pbx[i].Size = new Size(150, 150);
-
pbx[i].SizeMode = PictureBoxSizeMode.StretchImage;
-
pbx[i].BackgroundImage = Image.FromStream(str[i]);
-
pbx[i].Visible = true;
-
//this.Controls.Add(pbx[i]);
-
}
-
PLEASE TELL IS IT ANY WRONG WITH THIS CODE?
OR SUGGEST NEW CODE TO ME PLEASE..
its very urgent