protected void Page_Load(object sender, EventArgs e)
{
int i = 0;
string sb = Session["subcat"].ToString();
string cstring;
cstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/") + "db1.mdb";
//specify the connection
conn.ConnectionString = cstring;
conn.Open();
//create sqlcommand
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandText = "select sphoto ,itemname from itemsale where itemsubcat=" + "'" + sb + "'";
OleDbDataReader dr = cmd.ExecuteReader();
Table tc = new Table();
while (dr.Read())
{
//for (int rno = 0; rno <= 2; rno++)
//{
TableRow tr = new TableRow();
for (int cno = 0; cno <= 2; cno++)
{
TableCell td = new TableCell();
Label lb = new Label();
lb.Text = "<img src=" + dr.GetString(0) + ">";
HyperLink href = new HyperLink();
href.Text = dr.GetString(1);
href.NavigateUrl = "view1.aspx";
tr.Cells.Add(td);
td.Controls.Add(lb);
td.Controls.Add(new LiteralControl("<br>"));
td.Controls.Add(href);
}
tc.Rows.Add(tr);
//}
Panel1.Controls.Add(tc);
}
}