9
Answers

Button Event

Amy Turnbull

Amy Turnbull

17y
3.4k
1
Anyone tell me why after pressing the CheckOut button it dont go to the CheckIn button after, this is my code, any questions let me know

string myConnectionString = (string) ConfigurationSettings.AppSettings["ConnectionString"];   
   
// create connection
   
SqlConnection cnn = new SqlConnection(myConnectionString);
               
// create command

SqlCommand cmd = cnn.CreateCommand();
cmd.CommandType = CommandType.Text;

string CheckedOut = "0";

if (CheckedOut == "1")
{
cmd.CommandText = "select * from CheckedOut where CheckedOut = '1'";   
CheckOut.Visible = false;
CheckIn.Visible = true;
Console.WriteLine("Please check IN your IR");
}
else
{
cmd.CommandText = "select * from CheckedOut where CheckedOut = '0'";
CheckIn.Visible = false;
CheckOut.Visible = true;
Console.WriteLine("Check OUT IR first");
}
}
Answers (9)