目前做了一个网站,用到了注册页面,用户注册完后,要修改自己的注册信息,
  就遇到了一个难题,求大家帮忙:
     在修改用户注册页面上的textbox要怎么显示已注册过的内容?
 比如,一个textbox前面注册过姓名,后面的修改页面的textbox要怎么调出它的姓名,并修改保存!

解决方案 »

  1.   

    数据绑定
    比如
    <%@ Page Language="C#" %>
    <script runat="server">    TextBox1.Text="hello word";//在这儿向TextBox1绑定数据
       </script>
    <html>
    <head>
    </head>
    <body>
        <form runat="server">
            <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
            <!-- Insert content here -->
        </form>
    </body>
    </html>
      

  2.   

    从数据库中读取姓名的值,把这个值赋组textbox的Text属性不就行了.
      

  3.   

    后来程序写标记,表明是编辑页面还是注册页面,不想让用户改的信息就让他enable= false;
      

  4.   

    void Button_Click(Object sender , EventArgs e)
    {
            SqlConnection conPubs;
            string  strUpdate;
            SqlCommand cmdUpdate;
            int intUpdateCount;        conPubs = new SqlConnection( @"Server=dk;uid=sa;password=818;database=Pubs" );//你的数据库设置
            strUpdate = "Update Authors set phone=@phone  Where au_fname=@firstname and au_lname=@lastname";//更新修改后的数据
            cmdUpdate = new SqlCommand( strUpdate, conPubs );
            cmdUpdate.Parameters.Add( "@phone", txtPhone.Text );
            cmdUpdate.Parameters.Add( "@firstname", txtFirstName.Text );
            cmdUpdate.Parameters.Add( "@lastname", txtLastName.Text );
            conPubs.Open();
            intUpdateCount = cmdUpdate.ExecuteNonQuery();
            conPubs.Close();
            lblResults.Text = intUpdateCount + " records updated!";
    }void Button2_Click(object sender, EventArgs e) {
    SqlConnection conPubs = new SqlConnection( @"Server=OCEAN;uid=sa;pwd=491818;database=pubs" );
            conPubs.Open(); 
            SqlCommand cmdSelectAuthors = new SqlCommand( "Select phone From Authors", conPubs );
            SqlDataReader dtrAuthors = cmdSelectAuthors.ExecuteReader();
            dtrAuthors.Read();        txtPhone.Text=(string)( dtrAuthors[ "phone" ] );//将查询的数据显示
             dtrAuthors.Close();
            conPubs.Close();
    }
    //可以啊以上代码我试过是可以通过的啊
      

  5.   

    void Button_Click(Object sender , EventArgs e)
    {
            SqlConnection conPubs;
            string  strUpdate;
            SqlCommand cmdUpdate;
            int intUpdateCount;        conPubs = new SqlConnection( @"Server=dk;uid=sa;password=818;database=Pubs" );//你的数据库设置
            strUpdate = "Update Authors set phone=@phone  Where au_fname=@firstname and au_lname=@lastname";//更新修改后的数据
            cmdUpdate = new SqlCommand( strUpdate, conPubs );
            cmdUpdate.Parameters.Add( "@phone", txtPhone.Text );
            cmdUpdate.Parameters.Add( "@firstname", txtFirstName.Text );
            cmdUpdate.Parameters.Add( "@lastname", txtLastName.Text );
            conPubs.Open();
            intUpdateCount = cmdUpdate.ExecuteNonQuery();
            conPubs.Close();
            lblResults.Text = intUpdateCount + " records updated!";
    }void Button2_Click(object sender, EventArgs e) {
    SqlConnection conPubs = new SqlConnection( @"Server=dk;uid=sa;pwd=818;database=pubs" );
            conPubs.Open(); 
            SqlCommand cmdSelectAuthors = new SqlCommand( "Select phone From Authors", conPubs );
            SqlDataReader dtrAuthors = cmdSelectAuthors.ExecuteReader();
            dtrAuthors.Read();        txtPhone.Text=(string)( dtrAuthors[ "phone" ] );//将查询的数据显示
             dtrAuthors.Close();
            conPubs.Close();
    }如用First Name: ann
     Last Name:dull
    试试