先边userid主键读出来就可以update了,哈哈……

解决方案 »

  1.   

    去Microsoft quickstart 看看,很多新手的例子
    http://chs.gotdotnet.com/quickstart/default.aspx
      

  2.   

    先根据userid获取数据,修改后再根据userid更新
      

  3.   

    通过你的userid update.在你点按钮的时候..
      

  4.   

    aspx代码(sex=1为男,sex=0为女)
     <asp:TextBox ID="txtname" runat="server" Width="140px"></asp:TextBox> 
    <asp:DropDownList ID="ddlsex"  runat="server" DataValueField="sex " OnSelectedIndexChanged="ddlParentCategory_SelectedIndexChanged" AutoPostBack="True">
     </asp:DropDownList>
    cs文件
    (现将用户的基本信息取出放在一个dataset里边ds)
    txtname.Text = ds.tables[0].rows[0]["name"].ToString();
    ddlManufacture.SelectedValue = ds.tables[0].rows[0]["sex "].ToString();
    点击button出发的事件
      

  5.   

    dropdownlist控件写在aspx里<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
                        <asp:ListItem Value="0" Selected="True">男</asp:ListItem>
                        <asp:ListItem Value="1">女</asp:ListItem>
                    </asp:DropDownList>button1的click事件里string constr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
               SqlConnection conn = new SqlConnection(constr);
    SqlCommand comm = new SqlCommand("insert into people (name,sex)values(@name,@sex)",coon);
    comm.Parameters.Add("name", SqlDbType.VarChar, 20);
                        comm.Parameters["name"].Value = TextBox1.Text;
    comm.Parameters.Add("Sex", SqlDbType.Int, 4);
                        comm.Parameters["Sex"].Value = DropDownList1.SelectdItem.Text;
      

  6.   

    取出来 绑定 一下 ,直接UPDATE 就可以了
      

  7.   

    str sql="select * from people where userid ='"+ id+"'";SqlDataReader sdr = dot.getRow(sql);
    sdr.read();
    textBox1.text=sdr["name"].ToString();
    string name=textbox1.text;
    string sex=DROPDOWENLIST1.text;
    string sql1="UPDATE people set name='"+name+"' ,sex='"+sex+"' where userid='"+id+"'"; 
    if(DOT.execSQL(sql1))
    {
        成功
    }
    else
    {
        失败
    }