예제 #1
0
        private void checklogin(string qry)
        {
            try
            {
                DB_Connection dB_Connection = new DB_Connection();

                DataTable dt = dB_Connection.getDataGrid(qry);
                if (dt.Rows.Count == 1)
                {
                    GMS_1v gMS_1V = new GMS_1v();

                    gMS_1V.Show();
                    ((Form)this.TopLevelControl).Hide();
                }
                else
                {
                    MessageBox.Show("Your Username or Password is incorrect! Check your username , password and try again!");
                    Username_tb_lg.Text = "";
                    Password_tb_lg.Text = "";
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            userControl11.inputs_ftl_1();
            ft_login_form21.input_ftl_2();
            string Username, Company_Name, Password, Password_hint, pin_Number;

            Username      = userControl11.username;
            Company_Name  = userControl11.companyname;
            Password      = ft_login_form21.password;
            Password_hint = ft_login_form21.passwordhint;
            pin_Number    = ft_login_form21.pinnumber;

            DB_Connection dB_Connection = new DB_Connection();
            string        qry           = "INSERT INTO Usertb (Username,Company_Name,Password,Password_hint,Pin_Number) VALUES ('" + Username + "','" + Company_Name + "','" + Password + "','" + Password_hint + "','" + pin_Number + "')";
            string        qry2          = "Select * From Usertb";

            dB_Connection.InsertData(qry);
            DataTable dt = dB_Connection.getDataGrid(qry2);

            if (dt.Rows.Count != 0)
            {
                GMS_1v gMS_1V = new GMS_1v();
                gMS_1V.ShowDialog();
                Console.WriteLine(qry);
            }
        }