📄 contact.ascx.cs
字号:
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 ascx_Contact : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
Message.Text = "";
Label1.Text = "";
}
protected void Submit_Click(object sender, EventArgs e)
{
//string connstr = "server=localhost;Database=library1;User ID=sa;Password=''";
//SqlConnection conn = new SqlConnection(connstr);
DataControl.ConnectionControl conn = new DataControl.ConnectionControl();
conn.DataConnetion();
SqlCommand cmd= conn.DataCmd("update [UserInfo] set Email='" + tbEmail.Text.Trim() + "', Telephone='" + this.tbTelephone.Text.Trim() + "'where UserID='" + Session["UserID"].ToString().Trim() + "'");
//SqlCommand cmd = new SqlCommand("update [UserInfo] set Email='" + tbEmail.Text.Trim() + "', Telephone='" + this.tbTelephone.Text.Trim() + "'where UserID='" + Session["UserID"].ToString().Trim() + "'", conn);
//SqlDataReader dr;
try
{
//conn.Open();
cmd.ExecuteNonQuery();
Message.Text = "修改成功!";
Label1.Text = "修改信息在下次登陆时生效!";
}
catch (Exception e2)
{
Response.Write(e2.Message.ToString());
}
finally
{
conn.Close();
}
}
protected void Cancle_Click(object sender, EventArgs e)
{
tbTelephone.Text = "";
tbEmail.Text = "";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -