ASP.NET AJAX

SqlDataReader 로 넘어온값의 컬럼을 알아보기

스티커 2009. 4. 15. 15:00

image

1.위의 구조를 가진 데이터리더를 받았다

SqlDataReader reader = command.ExecuteReader();

 

 

2. 만약 저위의 칼럼을 알수 없을때 Load 를 사용하면  위와같은 디비스키마를 받아온다
DataTable tbl = new DataTable();
if (reader.HasRows)
   tbl.Load(reader);

foreach (DataColumn c in tbl.Columns)
{

    Response.Write(c.ColumnName + "<br>");

}