You follow the below steps for this process,
1.Create two textboxes in design form.
2.In coding you need to follow the below process,
using System.Data.Sqlclient;
oledbconnection con;
oledbdatareader dr;
oledbcommand cmd;
con=new sqlconnection ("Data Source= ;Integrated Security= ;User Id= ; Pwd= '");
{
con.Open();
cmd = new SqlCommand("SELECT UserName ,pwd FROM [aaa] WHERE UserName='" + textBox1.Text + "' AND pwd='" + textBox2.Text + "'", con);
SqlDataReader dr = cmd.ExecuteReader();
string userText = textBox1.Text;
string passText = textBox2.Text;
if (dr.Read())
{
this.Hide();
ddd mp = new ddd();
mp.Show();
dr.Close();
con.Close();
}
}
If you are following the above steps you will get the output perfectly.