医院结算系统——注册登录

Posted lgy316

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了医院结算系统——注册登录相关的知识,希望对你有一定的参考价值。

医院结算系统——注册

 1 using System;
 2 
 3 
 4 using System.Collections.Generic;
 5 using System.ComponentModel;
 6 using System.Data;
 7 using System.Drawing;
 8 using System.Linq;
 9 using System.Text;
10 using System.Windows.Forms;
11 using System.Data.SqlClient;
12 namespace 医院结算系统
13 {
14 public partial class Form1 : Form
15 {
16 public Form1()
17 {
18 InitializeComponent();
19 }
20 
21 private void button1_Click(object sender, EventArgs e)
22 {
23 
24 if (this.txt_user.Text.Trim() == "")
25 
26 {
27 
28 MessageBox.Show("操作员工号不为空!");
29 
30 this.txt_user.Focus();
31 
32 return;
33 
34 }
35 
36 if (this.txt_pwd.Text.Trim() == "")
37 
38 {
39 
40 MessageBox.Show("密码不能为空!");
41 
42 this.txt_pwd.Focus();
43 
44 return;
45 
46 }
47 
48 SqlConnection sqlConnection = new SqlConnection();
49 
50 sqlConnection.ConnectionString =
51 "Server=(local);Database=MZJJSFXT;Integrated Security=sspi";
52 SqlCommand sqlCommand = sqlConnection.CreateCommand(); sqlCommand.CommandText = "INSERT dbo.操作员信息表 (工号,操作员,密码,窗口号) VALUES(@工号,@操作员,HASHBYTES(‘MD5‘,@密码),@窗口号);";
53 
54 sqlCommand.Parameters.AddWithValue("@工号", this.txt_user.Text.Trim()); sqlCommand.Parameters.AddWithValue("@密码", this.txt_pwd.Text.Trim()); sqlCommand.Parameters.AddWithValue("@操作员", this.txt_name.Text.Trim()); sqlCommand.Parameters.AddWithValue("@窗口号", this.txt_kou.Text.Trim());
55 
56 
57 sqlCommand.Parameters["@密码"].SqlDbType = SqlDbType.VarChar;
58 
59 sqlConnection.Open();
60 
61 int rowAffected = sqlCommand.ExecuteNonQuery();
62 
63 sqlConnection.Close();
64 
65 if (rowAffected == 1)
66 
67 {
68 
69 MessageBox.Show("注册成功。");
70 登录 fa = new 登录();
71 fa.Show();
72 }
73 
74 else
75 
76 {
77 
78 MessageBox.Show("注册失败!");
79 
80 }
81 
82 }
83 
84  
85 
86 private void button2_Click(object sender, EventArgs e)
87 {
88 txt_kou.Text = "";
89 txt_name.Text = "";
90 txt_pwd.Text = "";
91 txt_user.Text = "";
92 }

 

技术分享图片

医院结算系统——登录

 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Linq;
 7 using System.Text;
 8 using System.Windows.Forms;
 9 using System.Data.SqlClient;
10 namespace 医院结算系统
11 {
12     public partial class 登录 : Form
13     {
14         public 登录()
15         {
16             InitializeComponent();
17         }
18 
19         private void 登录_Load(object sender, EventArgs e)
20         {
21 
22         }
23 
24         private void button1_Click(object sender, EventArgs e)
25         {
26             if (this.txt_user.Text.Trim() == "")
27             {
28 
29                 MessageBox.Show("操作员姓名不为空!");
30 
31                 this.txt_user.Focus();
32 
33                 return;
34 
35             }
36 
37             if (this.txt_pwd.Text.Trim() == "")
38             {
39 
40                 MessageBox.Show("密码不能为空!");
41 
42                 this.txt_pwd.Focus();
43 
44                 return;
45 
46             }
47 
48             SqlConnection sqlConnection = new SqlConnection();
49             sqlConnection.ConnectionString =
50             "Server=(local);Database=MZJJSFXT;Integrated Security=sspi";
51             SqlCommand sqlCommand = new SqlCommand();
52             sqlCommand.Connection = sqlConnection;
53             sqlCommand.CommandText =
54   "SELECT COUNT(1) FROM dbo.操作员信息表"
55   + " WHERE 操作员=‘" + this.txt_user.Text.Trim() + ""
56   + " AND 密码=HASHBYTES(‘MD5‘,‘" + this.txt_pwd.Text.Trim() + "‘);";
57            
58            
59             sqlConnection.Open();
60 
61             int rowCount = (int)sqlCommand.ExecuteScalar(); 
62             sqlConnection.Close();
63 
64             if (rowCount == 1)
65             {
66                 
67                 MessageBox.Show("登录成功。");
68 
69             }
70 
71             else
72             {
73 
74                 MessageBox.Show("登录失败!");
75 
76             }
77 
78         }
79 
80         private void Form1_Load(object sender, EventArgs e)
81         {
82 
83         }
84 
85         private void button2_Click(object sender, EventArgs e)
86         {
87             
88             txt_pwd.Text = "";
89             txt_user.Text = "";
90         }
91 
92     }
93 
94 }
技术分享图片

 


 

以上是关于医院结算系统——注册登录的主要内容,如果未能解决你的问题,请参考以下文章

医院结算系统——需求分析

医院结算系统——数据库模型图

基于SSH的医院在线挂号

医院门诊管理系统——计件收费

基于javaweb的医院挂号预约系统

基于SSH的医院挂号预约系统(MySQL版)