开发者

Binding Data from A Dataset to a <asp:Table>

Here I got slapped by a nice Surprise! <asp:Table> has no DataSource property. So far I have this code.

System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Careers"].Co开发者_StackOverflownnectionString);
conn.Open();
System.Data.SqlClient.SqlCommand comm = new System.Data.SqlClient.SqlCommand("SELECT * FROM Careers", conn);
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(comm);
System.Data.DataSet ds = new System.Data.DataSet();
da.Fill(ds);
System.Data.DataTable dt = ds.Tables[0];
//tbVCareers.IMAGINARYDATASOURCE = dt;
tbVCareers.DataBind();

This is only a testpage I am writing , so the Table is not supposed to look pretty. How am I to bind Data to this table? Note, this is not the same database connection that I posted in an earlier question. Any insight someone can Lend to me?


<asp:Table> is not data control, so you cannot do that with <asp:Table>. you have to use <asp:GridView>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜