コード例 #1
0
 private void BindBrandRepeater()
 {
     using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyWebsiteDB"].ConnectionString))
     {
         using (SqlCommand cmd = new SqlCommand("select * from Tbl_Brands", con))
         {
             using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
             {
                 DataTable dt = new DataTable();
                 sda.Fill(dt);
                 RepeaterBrand.DataSource = dt;
                 RepeaterBrand.DataBind();
             }
         }
     }
 }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     RepeaterBrand.DataSource = repoBrand.GetAll().ToList();
     RepeaterBrand.DataBind();
 }