Esempio n. 1
0
    private void BindBrands()
    {
        SqlCommand cmd = new SqlCommand("sp_Brand1", con);

        cmd.CommandType = CommandType.StoredProcedure;
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataTable      dt  = new DataTable();

        adp.Fill(dt);
        if (dt.Rows.Count != 0)
        {
            Brand.DataSource     = dt;
            Brand.DataTextField  = "BrandName";
            Brand.DataValueField = "BrandId";
            Brand.DataBind();
            Brand.Items.Insert(0, new ListItem("-Select-", "0"));
        }
    }