2014年11月13日 星期四

ADO使用

InterfaceRepository<Labor> repository = new LaborRepository();
            var customers = repository.Select();
            var customer = customers.Where(
                           c => c.BIid == Convert.ToInt32(2)).First();//數字代表ID
            Label1.Text = customer.Cname;
            customers = null;

以上是 抓出單項數值的ADO寫法
--------------------------------------------------------------------------------

InterfaceRepository<Labor> repository = new LaborRepository();
            this.gv.DataSource = repository.Select();
            this.gv.DataBind();
            repository = null;

以上是把資料整個丟進gridview 的寫法


---------------------------------------------------------------------------------

沒有留言:

張貼留言