?? bedhos.aspx.cs
字號:
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 醫院管理系統
{
/// <summary>
/// bedhos 的摘要說明。
/// </summary>
public class bedhos : System.Web.UI.Page
{
protected System.Data.SqlClient.SqlConnection cnn;
protected System.Web.UI.WebControls.Button Button2;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.TextBox Tjcs;
protected System.Web.UI.WebControls.TextBox Tcjs;
protected System.Web.UI.WebControls.TextBox Tcs;
protected System.Web.UI.WebControls.TextBox Thid;
protected System.Web.UI.WebControls.Image Image1;
protected System.Data.SqlClient.SqlCommand cmm;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此處放置用戶代碼以初始化頁面
}
#region Web 窗體設計器生成的代碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 該調用是 ASP.NET Web 窗體設計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.cnn = new System.Data.SqlClient.SqlConnection();
this.cmm = new System.Data.SqlClient.SqlCommand();
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
//
// cnn
//
this.cnn.ConnectionString = "workstation id=\"802-HUANGHAI\";packet size=4096;integrated security=SSPI;data sour" +
"ce=\".\";persist security info=False;initial catalog=醫院管理系統";
//
// cmm
//
this.cmm.CommandText = "[bedin]";
this.cmm.CommandType = System.Data.CommandType.StoredProcedure;
this.cmm.Connection = this.cnn;
this.cmm.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.cmm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@hID", System.Data.SqlDbType.NVarChar, 10));
this.cmm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@層數", System.Data.SqlDbType.Int, 4));
this.cmm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@層間數", System.Data.SqlDbType.Int, 4));
this.cmm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@間床數", System.Data.SqlDbType.Int, 4));
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
try
{
if(cnn.State==0) cnn.Open();
cmm.Parameters["@hid"].Value =Thid.Text;
cmm.Parameters["@層數"].Value =Tcs.Text;
cmm.Parameters["@層間數"].Value =Tcjs.Text;
cmm.Parameters["@間床數"].Value =Tjcs.Text;
cmm.ExecuteNonQuery();
cnn.Close();
}
catch
{
Response.Write("<script language=javascript>alert('沒認真填寫完或棟號有相同的!');</script>") ;
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
this.Response.Redirect("bedid.aspx");
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -