Hệ thống quản lý phòng tập trong C#

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
11 namespace
GymManagementSystem
12 {
13     
public partial class Form1 : Form
14     {
15         
public Form1()
16         {
17             InitializeComponent();
18         }
19
20         
private void button1_Click(object sender, EventArgs e)
21         {
22             SqlConnection con =
new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=F:\Sem.4\C# Projects\GymManagementSystem in C#\GymManagementSystem\Gym.mdf;Integrated Security=True;User Instance=True");
23             con.Open();
24             
string str = "SELECT emp_username FROM employee WHERE password='" + textBox2.Text + "'";
25             SqlCommand cmd =
new SqlCommand(str, con);
26             SqlDataReader dr;
27             dr = cmd.ExecuteReader();
28             
if (dr.Read())
29             {
30                 
this.Visible = false;
31                 Home obj2 =
new Home();
32                 obj2.ShowDialog();
33             }
34             
else
35             {
36                 MessageBox.Show(
"Invalid username and Password.");
37             }
38         }
39
40         
private void button2_Click(object sender, EventArgs e)
41         {
42             
this.Hide();
43             Register obj1 =
new Register();
44             obj1.ShowDialog();
45         }
46     }
47 }


Gõ tìm kiếm nhanh...