dropdownlist动态添加全部

string lid = Convert.ToString(this.ddllang.SelectedValue);
string sql = string.Format("select * from protype where lid={0}",lid);
DataTable dt = db.GetTable(sql);
DataRow dr = dt.NewRow();
dr["typeid"]="-1";
dr["typename"]="青岛新闻";
dt.Rows.InsertAt(dr,0);
this.ddltype.DataSource=dt;
this.ddltype.DataTextField="typename";
this.ddltype.DataValueField="typeid";
this.ddltype.DataBind();

你可能感兴趣的:(sql)