需求如下 
比如我数据库里有记录
一个页面下有多个textbox 有一个下拉框  下拉框里显示一张表 一个字段的信息  当选择了 其中一个所有textbox.text全部显示那个下拉框所选的所有其他字段的值
比如表 有 a b c d字段   下拉框已a字段  当我选择1记录的时候  其他3个textbox.text显示1记录的b c d字段 当下拉框选择2的时候 显示2记录的b c d字段  我记得应该是装在DataSet 里然后怎么写的 告诉我个方法赖~~谢谢~~~

解决方案 »

  1.   

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string strcon = "";
            SqlConnection con = new SqlConnection(strcon);
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;
            cmd.CommandText = "select * from C1_Employee where ID=" + this.DropDownList1.SelectedItem.Value;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);        this.tbxNo.Text = ds.Tables[0].Rows[0]["JobNo"].ToString();
            this.tbxEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString();
            this.ddlSex.SelectedValue = ds.Tables[0].Rows[0]["Sex"].ToString();
            this.tbxBirth.Text = ds.Tables[0].Rows[0]["BirthDay"].ToString();
            this.txtDuty.Text = ds.Tables[0].Rows[0]["Duty"].ToString();
            this.tbxID.Text = ds.Tables[0].Rows[0]["IDCard"].ToString();
            this.tbxPhone.Text = ds.Tables[0].Rows[0]["Tel"].ToString();
            this.tbxMobile.Text = ds.Tables[0].Rows[0]["Mobile"].ToString();
            this.tbxAddress.Text = ds.Tables[0].Rows[0]["Address"].ToString();
        }