Click here to Skip to main content
15,741,688 members

Comments by Judel Dobbs (Top 3 by date)

Judel Dobbs 12-Dec-21 10:52am View    
Ok a postfix expression gets characters such as 11*. Postfix gets the values before the perform the calculation on the operand. The Expression adds the characters one by one to a stack and performs the required operation if it's a value or an operand. The operation is pop or push. If a character is a number add it to the stack. IF ITS A operator pop and perform calculation until the stack is empty.
11* would return the value 1
Judel Dobbs 1-Dec-21 15:28pm View    
Thanks for your detailed response and reaching out to my problem. Ive added the code
Judel Dobbs 1-Dec-21 15:27pm View    
private void button1_Click(object sender, EventArgs e)
{

SqlConnection sqlco = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\plumz\OneDrive\Documents\Programming Project 2021\PROGRAM\Database\Gym_Management_DB.mdf;Integrated Security=True;Connect Timeout=30");
SqlCommand cmd = new SqlCommand("SELECT * FROM log_data WHERE username = '" + username.Text.Trim() + "' AND password = '" + password.Text.Trim() + "' ", sqlco);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
string usertype = user_type.SelectedItem.ToString();
if (dt.Rows.Count > 0)
{

for (int i = 0; i < dt.Rows.Count; i++)//state rows in table
{
if (dt.Rows[i]["usertype"].ToString() == usertype)
{
MessageBox.Show("You are logged in as " + dt.Rows[i][2]);
switch (user_type.SelectedIndex)

{
case 0:
{
customer customer1 = new customer();
customer1.Show();
this.Hide();
break;
}

case 1:
{
Staff staff1 = new Staff();
staff1.Show();
this.Hide();
break;
}

case 2:
{
Trainer trainer1 = new Trainer();
trainer1.Show();
this.Hide();
break;
}
default:
MessageBox.Show("wah gwan");
break;
} // end nested switch

} //end check for user type


}// end for loop
}// end row count
else

{
MessageBox.Show("The username or password is incorrect,Try Again");
}








} // end button LOG IN CLICK