Hi,
I have on my form a Timer1, Label1 and Label2.
Then on my OnLoad Event I put:
- Timer1.Start();
- conn = new SqlConnection("Data Source = (LocalDB)\\MSSQLLocalDB; AttachDbFilename=C:\\myFolder\\App_Datas\\DB.mdf;Integrated Security = True;Integrated Security = True");
- conn.Open();
- string commandString = "select top 1 * from operation where S='" + "S" + "' order by nord desc";
- SqlCommand comm = new SqlCommand(commandString, conn);
- SqlDataReader read = comm.ExecuteReader();
- if (read.HasRows)
- {
- while (read.Read())
- {
- Label1.Text = read["time"].ToString();
- }
- }
- else
- {
- }
- read.Close();
- conn.Close();
- if Label1.Text = DateTime.Now.ToString()
- Label2.txt = "Yes";
On my timer_Click I put this:
- Label1.Text = DateTime.Now.ToString("HH:mm");
What I need?
When the time its equal to the date system its should display on Label2 the word "yes". Otherwise its cant activate the second Label2.