📄 nurselogin.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;
using System.Data.OleDb;
public partial class NurseLogin : System.Web.UI.Page
{
int count = 0;
string []strCount = new string[26];
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("welcome,dear " + Session["UserName"].ToString() + "<br>");
Response.Write(System.DateTime.Now.ToString());
btnOut.Visible = true;
}
protected void btnOk_Click(object sender, EventArgs e)
{
int[] iCount = new int [26];
int[] iNewCount = new int[26];
for(int i = 0; i < 26; i++)
{
iCount[i] = 0;
iNewCount[i] = 0;
}
if ((txt0.Text.Equals(null)) || (txt0.Text == ""))
{
txt0.Text = "0";
}
if ((txt1.Text.Equals(null)) || (txt1.Text == ""))
{
txt1.Text = "0";
}
if ((txt2.Text.Equals(null)) || (txt2.Text == ""))
{
txt2.Text = "0";
}
if ((txt3.Text.Equals(null)) || (txt3.Text == ""))
{
txt3.Text = "0";
}
if ((txt4.Text.Equals(null)) || (txt4.Text == ""))
{
txt4.Text = "0";
}
if ((txt5.Text.Equals(null)) || (txt5.Text == ""))
{
txt5.Text = "0";
}
if ((txt6.Text.Equals(null)) || (txt6.Text == ""))
{
txt6.Text = "0";
}
if ((txt7.Text.Equals(null)) || (txt7.Text == ""))
{
txt7.Text = "0";
}
if ((txt8.Text.Equals(null)) || (txt8.Text == ""))
{
txt8.Text = "0";
}
if ((txt9.Text.Equals(null)) || (txt9.Text == ""))
{
txt9.Text = "0";
}
if ((txt10.Text.Equals(null)) || (txt10.Text == ""))
{
txt10.Text = "0";
}
if ((txt11.Text.Equals(null)) || (txt11.Text == ""))
{
txt11.Text = "0";
}
if ((txt12.Text.Equals(null)) || (txt12.Text == ""))
{
txt12.Text = "0";
}
if ((txt13.Text.Equals(null)) || (txt13.Text == ""))
{
txt13.Text = "0";
}
if ((txt14.Text.Equals(null)) || (txt14.Text == ""))
{
txt14.Text = "0";
}
if ((txt15.Text.Equals(null)) || (txt15.Text == ""))
{
txt15.Text = "0";
}
if ((txt16.Text.Equals(null)) || (txt16.Text == ""))
{
txt16.Text = "0";
}
if ((txt17.Text.Equals(null)) || (txt17.Text == ""))
{
txt17.Text = "0";
}
if ((txt18.Text.Equals(null)) || (txt18.Text == ""))
{
txt18.Text = "0";
}
if ((txt19.Text.Equals(null)) || (txt19.Text == ""))
{
txt19.Text = "0";
} if ((txt20.Text.Equals(null)) || (txt20.Text == ""))
{
txt20.Text = "0";
}
if ((txt21.Text.Equals(null)) || (txt21.Text == ""))
{
txt21.Text = "0";
}
if ((txt22.Text.Equals(null)) || (txt22.Text == ""))
{
txt22.Text = "0";
}
if ((txt23.Text.Equals(null)) || (txt23.Text == ""))
{
txt23.Text = "0";
}
if ((txt24.Text.Equals(null)) || (txt24.Text == ""))
{
txt24.Text = "0";
}
if ((txt25.Text.Equals(null)) || (txt25.Text == ""))
{
txt25.Text = "0";
}
OleDbConnection conn = new OleDbConnection();
string connStr = "Provider =Microsoft.Jet.OLEDB.4.0;Data Source = " + Server.MapPath("App_Data/Nurse.mdb");
conn.ConnectionString = connStr;
string strSql = "select * from Statistic";
string strSql1 = "";
conn.Open();
OleDbCommand selComm = new OleDbCommand(strSql, conn);
OleDbDataReader dr = selComm.ExecuteReader();
int n = 0;
while (dr.Read())
{
strCount[n] = (string)dr["strCount"];
iCount[n] = int.Parse(strCount[n]);
n++;
}
iNewCount[0] = iCount[0] + int.Parse(txt0.Text);
iNewCount[1] = iCount[1] + int.Parse(txt1.Text);
iNewCount[2] = iCount[2] + int.Parse(txt2.Text);
iNewCount[3] = iCount[3] + int.Parse(txt3.Text);
iNewCount[4] = iCount[4] + int.Parse(txt4.Text);
iNewCount[5] = iCount[5] + int.Parse(txt5.Text);
iNewCount[6] = iCount[6] + int.Parse(txt6.Text);
iNewCount[7] = iCount[7] + int.Parse(txt7.Text);
iNewCount[8] = iCount[8] + int.Parse(txt9.Text);
iNewCount[9] = iCount[9] + int.Parse(txt10.Text);
iNewCount[10] = iCount[10] + int.Parse(txt11.Text);
iNewCount[11] = iCount[11] + int.Parse(txt12.Text);
iNewCount[12] = iCount[12] + int.Parse(txt13.Text);
iNewCount[13] = iCount[13] + int.Parse(txt20.Text);
iNewCount[14] = iCount[14] + int.Parse(txt21.Text);
iNewCount[15] = iCount[15] + int.Parse(txt22.Text);
iNewCount[16] = iCount[16] + int.Parse(txt8.Text);
iNewCount[17] = iCount[17] + int.Parse(txt17.Text);
iNewCount[18] = iCount[18] + int.Parse(txt18.Text);
iNewCount[19] = iCount[19] + int.Parse(txt19.Text);
iNewCount[20] = iCount[20] + int.Parse(txt23.Text);
iNewCount[21] = iCount[21] + int.Parse(txt24.Text);
iNewCount[22] = iCount[22] + int.Parse(txt14.Text);
iNewCount[23] = iCount[23] + int.Parse(txt15.Text);
iNewCount[24] = iCount[24] + int.Parse(txt16.Text);
iNewCount[25] = iCount[25] + int.Parse(txt25.Text);
dr.Close();
conn.Close();
conn.Open();
for (int i = 0; i < 26; i++)
{
int temp = i + 1;
strSql1 = "update Statistic set strCount =" + iNewCount[i]
+ " where StatisticID ='" + temp.ToString() + "'";
OleDbCommand upComm = new OleDbCommand(strSql1, conn);
upComm.ExecuteNonQuery();
}
conn.Close();
lblResult.Text = "操作成功!";
}
protected void btnOut_Click1(object sender, EventArgs e)
{
Response.Redirect("Default.aspx?");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -