i'm working on a school project that i need to retrieve username and password from sql database
and, depending on username and password entered, open specific windows form
i have administrator forms, managers,employees ETC.
I'm able to open the forms with this code but its not what i need cause itsnt surfing through the database
so far i havent make it work to surf the database(i guess i could but i just dont know how to open differents forms to specific username and password)
i have tried many things and needless to say none of them works
i tried with a FOR loop
as you may notice im new at programming i dont want to get it done i just want to learn
thanks for any input
and, depending on username and password entered, open specific windows form
i have administrator forms, managers,employees ETC.
I'm able to open the forms with this code but its not what i need cause itsnt surfing through the database
so far i havent make it work to surf the database(i guess i could but i just dont know how to open differents forms to specific username and password)
i have tried many things and needless to say none of them works
i tried with a FOR loop
as you may notice im new at programming i dont want to get it done i just want to learn
thanks for any input
private void buttonGo_Click(object sender, EventArgs e)
{
/* //
SqlConnection thisConnection1 = new SqlConnection(@"server=(local);Integrated security=true;" + "database=mydatabase");
//
SqlDataAdapter thisAdapter1 = new SqlDataAdapter("SELECT UserName,Password,Title FROM Login", thisConnection1);
//
SqlCommandBuilder thisbuilder1 = new SqlCommandBuilder(thisAdapter1);
//
DataSet thisdataset1 = new DataSet();
//
thisAdapter1.Fill(thisdataset1, "Login");*/
if (TextBoxUsername.Text == "Mike" && TextBoxPassword.Text == "112")
{
Administration admin = new Administration();
admin.Visible = true;
admin.Activate();
TextBoxUsername.Clear();
TextBoxPassword.Clear();
this.Hide();
return;
}
if (TextBoxUsername.Text == "mike2" && TextBoxPassword.Text == "2012")
{
Admission admission = new Admission();
admission.Visible = true;
admission.Activate();
TextBoxUsername.Clear();
TextBoxPassword.Clear();
this.Hide();
return;
}
{
if (TextBoxUsername.Text == "mike3" && TextBoxPassword.Text == "2013")
{
Discharge_Patients DisPa = new Discharge_Patients();
DisPa.Visible = true;
DisPa.Activate();
TextBoxUsername.Clear();
TextBoxPassword.Clear();
this.Hide();
return;
}
{
if (TextBoxUsername.Text == "mike4" && TextBoxPassword.Text == "2011")
{
Patient_Report_List listPa = new Patient_Report_List();
listPa.Visible = true;
listPa.Activate();
TextBoxUsername.Clear();
TextBoxPassword.Clear();
this.Hide();
return;
}
{
if (TextBoxUsername.Text == "mike5" && TextBoxPassword.Text == "2010")
{
Discharge_Patients DisPa = new Discharge_Patients();
DisPa.Visible = true;
DisPa.Activate();
TextBoxUsername.Clear();
TextBoxPassword.Clear();
this.Hide();
return;
}
}
{
if (TextBoxUsername.Text == "mike6" && TextBoxPassword.Text == "2009")
{
Discharge_Patients DisPa = new Discharge_Patients();
DisPa.Visible = true;
DisPa.Activate();
TextBoxUsername.Clear();
TextBoxPassword.Clear();
this.Hide();
return;
}
}
{
if (TextBoxUsername.Text == "mike6" && TextBoxPassword.Text == "2008")
{
Patient_Report_List DisPa = new Patient_Report_List();
DisPa.Visible = true;
DisPa.Activate();
TextBoxUsername.Clear();
TextBoxPassword.Clear();
this.Hide();
return;
}
}
}
}