//[1] 변수 선언부
string strCon = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string strSql = "select * from Food_type order by typ_no desc";
//[2] 커넥션
SqlConnection objCon = new SqlConnection();
objCon.ConnectionString = strCon;
objCon.Open();
//[3] 커멘드
SqlCommand objCmd = new SqlCommand();
objCmd.Connection = objCon;
objCmd.CommandText = strSql;
objCmd.CommandType = CommandType.Text;
//[4] 데이터어댑터
SqlDataAdapter objDa = new SqlDataAdapter();
objDa.SelectCommand = objCmd;
//[5] 데이터셋
DataSet objDs = new DataSet();
objDa.Fill(objDs, "Food_type");
//[6] 그리드뷰 컨트롤
this.GridView1.DataSource = objDs;
this.GridView1.DataBind();
//[7] 마무리
objCon.Close();