Hey Guys I have a problem and don't know how to resolve it I check the tble and enter the data and have data inside when I try with if (DTA.Rows.Count > 0) nothing is happening it is not login in. Weird thing is I have another application where is this working but there I am using Username and Password and there I am using if (DTA.Rows.Count == 1)
SqlConnection CON = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\ECS_POS\ECS_POS\POS.mdf;Integrated Security=True;Connect Timeout=30");
DataTable DTA = new DataTable();
SqlDataAdapter SDA = new SqlDataAdapter("SELECT First,Role FROM users WHERE User='" + textBox1.Text + "'", CON);
SDA.Fill(DTA);
if (DTA.Rows.Count == 0)
{
if (DTA.Rows[0][0].ToString() == "something")
{
Home ss= new Home(DTA.Rows[0][0].ToString(), (DTA.Rows[0][1].ToString()));
ss.Show();
this.Hide();
}
else if (DTA.Rows[0][0].ToString() == "something")
{
Home ss = new Home(DTA.Rows[0][0].ToString(), (DTA.Rows[0][1].ToString()));
ss.Show();
this.Hide();
}
else if (DTA.Rows[0][0].ToString() == "something")
{
Home ss = new Home(DTA.Rows[0][0].ToString(), (DTA.Rows[0][1].ToString()));
ss.Show();
this.Hide();
}
else
{
MessageBox.Show("something something ");