DataRow 개체와 DataColumn 개체는 DataTable의 기본 구성 요소입니다. DataRow 개체 및 해당 속성과 메서드를 사용하여 DataTable의 값을 검색, 계산, 삽입, 삭제 및 업데이트합니다. |
using System.Configuration; public partial class Category_FrmDataRow : System.Web.UI.Page private void Display() con.Open(); DataSet ds = new DataSet(); da.Fill(ds, "Categories"); this.lstCategoryList.DataSource = ds; con.Close(); |
- Typically populated from database - Use DataRow for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //한개의 레코드를 DataRow에 담기 DataRow dr = ds.Tables[0].Rows[i] ; //[1]lstCategoryList.Items.Add(dr["CategoryID"].ToString()); //[2] 가장 일반적인 사용방법 lstCategoryList.Items.Add(new ListItem(dr ["CategoryName"].ToString(), dr["CategoryID"].ToString())); } |
'.Net Project > ADO.NET 3.5' 카테고리의 다른 글
13장 ADO.NET 메모리상의 DB 이용하여 주소록 만들기 (0) | 2009.09.29 |
---|---|
12장 ADO.NET 메모리상의 데이터 베이스(RowFilter) (0) | 2009.09.28 |
10장 ADO.NET 메모리상의 데이터 베이스(View) (0) | 2009.09.28 |
09장 ADO.NET 메모리상의 데이터 베이스(DataTable) (0) | 2009.09.28 |
08장 ADO.NET 메모리상의 데이터 베이스(DataSet) (0) | 2009.09.28 |