コード例 #1
0
ファイル: Login.cs プロジェクト: Hind1995/StockManagement
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection  con = Connection.GetConnection();
            SqlDataAdapter db  = new SqlDataAdapter("Select Count(*) From Login Where UserName='******'and Password ='******'", con);
            DataTable      dt  = new DataTable();

            db.Fill(dt);
            if (dt.Rows[0][0].ToString() == "1")
            {
                this.Hide();
                StockMain sm = new StockMain();
                sm.Show();
            }
            else
            {
                MessageBox.Show("Invalid UserName & Password..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
コード例 #2
0
ファイル: Login.cs プロジェクト: kaushik24596/StockManagement
        private void Login_Click(object sender, EventArgs e)
        {
            //Procedure for DBconeection
            SqlConnection  con = new SqlConnection("Data Source = DESKTOP-0G0868J; Initial Catalog = Stock; Integrated Security = True");
            SqlDataAdapter sda = new SqlDataAdapter(@"SELECT * FROM [dbo].[Login] where UserName='******' and Password='******'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();                //to hide loginForm
                StockMain main = new StockMain();
                main.Show();                //shows Stocks form
            }
            else
            {
                MessageBox.Show("Invalid Username & Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                clear_Click(sender, e);                 //to clear the feilds after pressing OK
            }
        }
コード例 #3
0
ファイル: Login.cs プロジェクト: vishnu03/Stock-Inventory
        private void button2_Click(object sender, EventArgs e)
        {
            //TODO : CheckLogin   username and password
            SqlConnection  conn = new SqlConnection("Data Source=.;Initial Catalog=Stock;Integrated Security=True");
            SqlDataAdapter sda  = new SqlDataAdapter(@"SELECT * FROM [dbo].[Login1] where UserName ='******' and Password ='******'", conn);
            DataTable      dt   = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid Username & password..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button1_Click(sender, e);
            }
        }
コード例 #4
0
        private void button_Login_Click(object sender, EventArgs e)
        {
            // TO-DO: Check Login username and password and redirect to main page

            SqlConnection  conn = new SqlConnection("Data Source=.;Initial Catalog=StockDb;Integrated Security=True");
            SqlDataAdapter sda  = new SqlDataAdapter(@"SELECT * FROM [StockDb].[dbo].[Login] where Username='******' and Password='******'", conn);
            DataTable      dt   = new DataTable();

            sda.Fill(dt);
            if (dt.Rows.Count == 1)
            {
                this.Hide();
                StockMain main = new StockMain();
                main.Show();
            }
            else
            {
                MessageBox.Show("Invalid Username and/or Password, please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                button_Clear_Click(sender, e);
            }
        }