UserManger/MyInfo.aspx.cs

(完整代码) 2KB

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class UserManger_MyInfo : System.Web.UI.Page
{
    SqlHelper data = new SqlHelper();
    protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
          
            SqlHelper data = new SqlHelper();

            int id = int.Parse(Session["userid"].ToString());
            SqlDataReader dr = data.GetDataReader("select * from UserInfo where Userid=" + id);
            dr.Read();
            txtName.Text = dr["UserName"].ToString();
            TextBox2.Text = dr["UserTruename"].ToString();
            TextBox3.Text = dr["Birthday"].ToString();
            TextBox4.Text = dr["Education"].ToString();
            TextBox5.Text = dr["tel"].ToString();
            TextBox6.Text = dr["Mobile"].ToString();
            TextBox7.Text = dr["EntryTime"].ToString();
          
            TextBox10.Text = dr["bumen"].ToString();

            Image1.ImageUrl = "../uploads/" + dr["Images"].ToString();
         
            TextBox8.Text = dr["roule"].ToString();

        }
    } 
    protected void Button1_Click(object sender, EventArgs e)
    {
        int id = int.Parse(Session["userid"].ToString());
        SqlHelper update = new SqlHelper();

        if (TextBox1.Text == "")
        {
            update.RunSql("update  UserInfo set UserName='" + txtName.Text + "',UserTruename='" + TextBox2.Text + "',roule='" + TextBox8.Text + "',Birthday='" + TextBox3.Text + "',Education='" + TextBox4.Text + "',tel='" + TextBox5.Text + "',Mobile='" + TextBox6.Text + "', EntryTime='" + TextBox7.Text + "'   where Userid=" + id);
        }
        else
        {
            update.RunSql("update  UserInfo set UserName='" + txtName.Text + "',UserTruename='" + TextBox2.Text + "',pwd='" + TextBox1.Text + "',roule='" + TextBox8.Text + "'  ,Birthday='" + TextBox3.Text + "',Education='" + TextBox4.Text + "',tel='" + TextBox5.Text + "',Mobile='" + TextBox6.Text + "', EntryTime='" + TextBox7.Text + "'   where Userid=" + id);
        }
        Alert.AlertAndRedirect("修改成功", "MyInfo.aspx");
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。