یه همچین چیزی چون بعضی جاهاش مشخص نبود
objCommand = new SqlCommand();
objConnection.Open();
objCommand.Connection = objConnection;
objCommand.CommandText = "select * from users ";
SqlDataAdapter da = newSqlDataAdapter();
DataTable dt = newDataTable();
da.SelectCommand = objCommand;
da.Fill(dt);
if (txtpass.Text == dt.Rows[0]["pass"].ToString() && txtuser.Text == dt.Rows[0]["user"].ToString() && dt.Rows[1]["role"].ToString()==1)
{
Form1 fm = newForm1();
this.Hide();
fm.ShowDialog();
}
elseif (txtpass.Text == dt.Rows[1]["pass"].ToString() && txtuser.Text == dt.Rows[1]["user"].ToString() && dt.Rows[1]["role"].ToString()==2)
{
Form2 fm = new Form2();
this.Hide();
fm.ShowDialog();
}
else
{
MessageBox.Show("نام کاربری و یا کلمه عبور صحیح نمی باشد", "پیام خطا ",MessageBoxButtons.OK,MessageBoxIcon.Warning,Messa geBoxDefaultButton.Button1,MessageBoxOptions.Right Align);
txtuser.Clear();
txtpass.Clear();
txtuser.Focus();
}