TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kshama parashar
NA
89
0
i want to reterive data from database in table form
Jun 17 2010 4:35 AM
i need only three cells in a row in asp.net (C#)
my code is
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);
}
}
Reply
Answers (
1
)
load file from link to literal web control
EDMX