예제 #1
0
        public main(login my_login)
        {
            InitializeComponent();
            this.mylogin = my_login;
            xuehao       = mylogin.getxuehao();
            SqlConnection conn1 = new SqlConnection();

            conn1.ConnectionString = @"Server = localhost;Database=CLASSTEST;integrated security=true";
            conn1.Open();

            string        strSqlq1 = "select * from student where 学号 = '" + xuehao + "'";
            SqlCommand    cmd1     = new SqlCommand(strSqlq1, conn1);
            SqlDataReader dr1      = cmd1.ExecuteReader();

            if (dr1.Read())
            {
                xingming.Text = dr1["姓名"].ToString();
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection();

            conn.ConnectionString = ConfigurationManager.ConnectionStrings["connstr"].ConnectionString;
            conn.Open();
            string user = textBox1.Text;
            string pass = textBox2.Text;
            string sql  = "insert into dbo.customer(username,password) values(" + user
                          + "," + pass + ")";
            SqlCommand cmd = new SqlCommand(sql, conn);

            cmd.ExecuteNonQuery();
            conn.Close();
            this.Hide();
            login log = new login();

            log.Show();
        }
예제 #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (userName_textBox.Text == "" || userName_textBox.Text == null)
     {
         MessageBox.Show("נא הקלד שם משתמש");
     }
     if (password_textBox.Text == "" || password_textBox.Text == null)
     {
         MessageBox.Show("נא הקלד סיסמא");
     }
     else
     {
         try
         {
             _username = userName_textBox.Text;
             _password = password_textBox.Text;
             login now = new login(_username, _password);
             if (now.ans == 1)
             {
                 MessageBox.Show("Welcome");
                 //now we want to move the homework page select game.
             }
             else if (now.ans == 2)
             {
                 askAdministrator_form k = new askAdministrator_form(this, _username);
                 k.Show();
                 this.Hide();
                 //here we move to the asking open administrator panle?
             }
             else
             {
                 MessageBox.Show("שם משתמש או סיסמא שגויים");
             }
         }
         catch (MySqlException ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
예제 #4
0
파일: login.cs 프로젝트: majiongben/kecheng
        private void button1_Click(object sender, EventArgs e)
        {
            xuehao = textBox1.Text;
            string mima     = textBox2.Text;
            login  my_login = new login();

            my_login.xuehao = xuehao;
            string        _connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["connectionstring"].ToString();
            SqlConnection conn = new SqlConnection(_connectionString);

            conn.Open();
            if (radioButton1.Checked)
            {
                string        strSql = "select * from student where 学号 = '" + xuehao + "'";
                SqlCommand    cmd    = new SqlCommand(strSql, conn);
                SqlDataReader dr     = cmd.ExecuteReader();
                if (dr.Read())
                {
                    if (mima.Equals(dr["密码"].ToString()))
                    {
                        MessageBox.Show("登陆成功!");
                        main zuoti = new main(my_login);
                        zuoti.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("密码错误!");
                    }
                }
                else
                {
                    MessageBox.Show("账号不存在!");
                }
            }
            if (radioButton2.Checked)
            {
            }
        }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            xuehao = textBox1.Text;
            string mima     = textBox2.Text;
            login  my_login = new login();

            my_login.xuehao = xuehao;
            SqlConnection conn = new SqlConnection();

            conn.ConnectionString = @"Server = localhost;Database=CLASSTEST;integrated security=true";
            conn.Open();
            if (radioButton1.Checked)
            {
                string        strSql = "select * from student where 学号 = '" + xuehao + "'";
                SqlCommand    cmd    = new SqlCommand(strSql, conn);
                SqlDataReader dr     = cmd.ExecuteReader();
                if (dr.Read())
                {
                    if (mima.Equals(dr["密码"].ToString()))
                    {
                        MessageBox.Show("登陆成功!");
                        main zuoti = new main(my_login);
                        zuoti.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("密码错误!");
                    }
                }
                else
                {
                    MessageBox.Show("账号不存在!");
                }
            }
            if (radioButton2.Checked)
            {
            }
        }