📄 userinfos.aspx.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;
public partial class UserInfos : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
userAcctent();
}
}
private void userAcctent()
{
string strSql = null;
if (Session["userID"] != null)
{
int UserID = Int32.Parse(Session["userID"].ToString());
strSql = "SELECT [userID],[userLoginID],[userPwd],[userName],[userStatus] FROM [userInfo] WHERE [userID] ='" + UserID + "'";
UserInfo userinfo = new UserInfo();
userinfo = DBhelper.sqlUserInfo(strSql);
txtLoginID.Text = userinfo.UserLoginID;
txtUserName.Text = userinfo.UserName;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (!txtLoginID.Text.Equals("") && !txtPwd.Text.Equals("") && !txtUserName.Text.Equals(""))
{
UserInfo userinfo = new UserInfo();
userinfo.UserLoginID = txtLoginID.Text;
userinfo.UserPwd = txtPwd.Text;
userinfo.UserName = txtUserName.Text;
string strSql = null;
if (Session["userID"] != null)
{
int UserID = Int32.Parse(Session["userID"].ToString());
strSql = "UPDATE [userInfo] SET [userLoginID]='" + userinfo.UserLoginID + "',[userPwd]= '" + userinfo.UserPwd + "',[userName]='" + userinfo.UserName + "' WHERE [userID]='" + UserID + "'";
}
else
{
strSql = "INSERT INTO [userInfo]([userLoginID],[userPwd],[userName],[userStatus]) VALUES('" + userinfo.UserLoginID + "','" + userinfo.UserPwd + "','" + userinfo.UserName + "',1)";
}
int i = DBhelper.sqlinit(strSql);
if (i > 0)
{
Response.Redirect("UserManager.aspx");
}
}
else
{
txtMsg.Text = "请完整的填写用户信息!";
}
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("UserManager.aspx");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -