public void LoadProvince(string ProvinceName)
 {
     Province.DataSource     = common.GetProvice();
     Province.DataTextField  = "ProvinceName";
     Province.DataValueField = "ProvinceName";
     Province.DataBind();
     Province.SelectedValue = ProvinceName;
 }
Beispiel #2
0
    public void LoadProvince()
    {
        Province.DataSource     = common.GetProvice();
        Province.DataTextField  = "ProvinceName";
        Province.DataValueField = "ProvinceName";
        Province.DataBind();

        ListItem Item = new ListItem();

        Item.Text  = "请选择";
        Item.Value = "-1";
        Province.Items.Insert(0, Item);
    }
    private void FindProvince()
    {
        string         sql     = "select ProSort,ProName from T_Province";
        SqlConnection  conn    = new SqlConnection("server=.;database=MarriageAndLove;uid=sa;pwd=conan;");
        SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
        DataSet        ds      = new DataSet();

        conn.Open();
        adapter.Fill(ds);
        conn.Close();
        Province.DataSource     = ds.Tables[0];
        Province.DataValueField = "ProSort";
        Province.DataTextField  = "ProName";
        Province.DataBind();
    }