Wednesday, September 6, 2017

C# windows application login

First open visual studio File->New->Project->Windows Froms Application-> Ok.














Then we use toolbox for design the input field and button.



















Click the submit button and paste the code.

      SqlConnection con = new SqlConnection(@"Data Source=USER;Initial Catalog=DATA;Integrated Security=True");


            SqlCommand cmd = con.CreateCommand();

            SqlDataAdapter sda = new SqlDataAdapter
                ("select count (*) from yy where id ='" + textBox1.Text + "' and   name = '" + textBox2.Text + "'", con);
            DataTable dt = new DataTable();
            sda.Fill(dt);

            if (dt.Rows[0][0].ToString() == "1")
            {
                this.Hide();
                Form2 ss = new Form2();
                ss.Show();

            }
            else
            {
                MessageBox.Show("Please check the password");

            }


After that create another skin or form.This is the following steps are showing under the below.

Step 1





















Step 2













Step 3













Then open the second form add a button and click on it and paste the code.

  this.Close();
















Then we save the code.Now click on start for execute the code. 



No comments:

Post a Comment