Hi,
i am using c# window application
I have create one Login Form. I want that when user put its username and password first it should check in the database and then it should give the out put. i have even create on signup form first it should be register with that form then he can go to login form.
The code i have written is
private void button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(@"Server=xxx\SQLEXPRESS;Database=xxx;Trusted_Connection= True");
conn.Open();
SqlCommand cmd = new SqlCommand("select * from signin where username='" + txtusername.Text + "'and password='" + txtpassword.Text + "'", conn);
cmd.ExecuteNonQuery();
conn.Close();
if
{
MessageBox.Show("You have successfully Login");
Form2 f1 = new Form2();
f1.Show();
{
MessageBox.Show("Incorrect Username and Password");
}
}
}
I am stuck in If else statement i am not getting what i write in that and even i am confused in how do i merge this table and give the output as i want i have directly insert the admin and password in sql but other its are not happening and even i have inner join the table but i am not getting the out put which i want i am very confused.
Hope i have am clear with what i want please help me please