reviseinformation.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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 reviseinformation : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string shopperid = Request.Cookies["userName"].Value.ToString().Trim();
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["shopConnectionString"].ToString());
        Label1 .Text =shopperid ;
    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList2.Items.Clear();
        SqlDataReader scReader = databaseAccess.Message(DropDownList1.SelectedValue);
        while (scReader.Read())
            DropDownList2.Items.Add(scReader["city"].ToString().Trim());
          scReader.Dispose();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sql;
        if(TextBox3 .Text ==TextBox4 .Text )
        {          
                             
            sql = string.Format("update shopper set psssword='{0}',email='{1}',address='{2}',country='{3}',province='{4}',city='{5}',postalcode='{6}',phone='{7}' where shopperID='{8}'", TextBox4.Text, TextBox5.Text, TextBox2.Text, TextBox1.Text, DropDownList1.SelectedItem.Value, DropDownList2.SelectedItem.Value, TextBox6.Text, TextBox7.Text, Label1.Text);
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["shopConnectionString"].ToString());
            SqlCommand comm = new SqlCommand();
            try
            {
                conn.Open();
                comm.CommandText = sql;
                comm.Connection = conn;
                comm.ExecuteNonQuery();
            }
            catch
            {
            }
        }
        if (TextBox3.Text.Trim() != TextBox4.Text.Trim())
        {
            Response.Write("<script language='javascript'>alert('请确认两次输入相同的密码')</script>");
            return;

        }
        Response.Write("<script language='javascript'>alert('修改成功')</script>");
        //Response.Redirect("login.aspx");
后面还有 8 行代码,购买后查看完整代码

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

AI 解读 AI

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

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