?? webmenu.aspx.cs
字號(hào):
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace 醫(yī)院管理系統(tǒng)
{
/// <summary>
/// webmenu 的摘要說(shuō)明。
/// </summary>
public class webmenu : System.Web.UI.Page
{
protected System.Web.UI.WebControls.HyperLink HyperLink1;
protected System.Web.UI.WebControls.HyperLink HyperLink2;
protected System.Web.UI.WebControls.HyperLink HyperLink3;
protected System.Web.UI.WebControls.HyperLink HyperLink4;
protected System.Web.UI.WebControls.Image Image1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Label Label1;
protected System.Data.SqlClient.SqlConnection cnn;
protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
protected System.Data.SqlClient.SqlDataAdapter sda;
protected System.Web.UI.WebControls.TextBox tpwd;
protected System.Web.UI.WebControls.TextBox tpwd1;
protected System.Web.UI.WebControls.CompareValidator CompareValidator1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.ValidationSummary ValidationSummary1;
Cpass cpa =new Cpass();
private void Page_Load(object sender, System.EventArgs e)
{
try
{
string user= Session["usename"].ToString();
string pwd=Session["pwds"].ToString() ; //獲得變量值
if(cpa.CH(user, pwd, "")=="Nopasscheck")//用戶名或密碼錯(cuò)
Response.Redirect("index.aspx");
}
catch{ Response.Redirect("index.aspx");}
Label1.Text=Session["usename"].ToString();
}
#region Web 窗體設(shè)計(jì)器生成的代碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 該調(diào)用是 ASP.NET Web 窗體設(shè)計(jì)器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.cnn = new System.Data.SqlClient.SqlConnection();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sda = new System.Data.SqlClient.SqlDataAdapter();
this.Button1.Click += new System.EventHandler(this.Button1_Click);
//
// cnn
//
this.cnn.ConnectionString = "workstation id=LYJ805;packet size=4096;integrated security=SSPI;data source=\".\";p" +
"ersist security info=False;initial catalog=醫(yī)院管理系統(tǒng)";
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = "[update1]";
this.sqlUpdateCommand1.CommandType = System.Data.CommandType.StoredProcedure;
this.sqlUpdateCommand1.Connection = this.cnn;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RETURN_VALUE", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(0)), ((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@useid", System.Data.SqlDbType.NVarChar, 20));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@pwd", System.Data.SqlDbType.NVarChar, 20));
//
// sda
//
this.sda.DeleteCommand = this.sqlDeleteCommand1;
this.sda.InsertCommand = this.sqlInsertCommand1;
this.sda.SelectCommand = this.sqlSelectCommand1;
this.sda.UpdateCommand = this.sqlUpdateCommand1;
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
//Label1.Text=Session["usename"].ToString();
if(cnn.State==0) cnn.Open();
sda.UpdateCommand.Parameters["@useid"].Value=this.Label1.Text;
sda.UpdateCommand.Parameters["@pwd"].Value =tpwd.Text;
sda.UpdateCommand.ExecuteNonQuery();
Response.Write("<script language=javascript>alert('修改成功!');</script>") ;
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -