when the row is empty then its not move to another row and it show an error:there is no row at the position
- public void loadAct()
- {
- string qryAct = "";
- DateNow = DateTime.Now.ToString("yyyy-MM-dd");
- DataTable dt2 = new DataTable();
- if (txtDate.Text != "")
- {
- qryAct = "select Line, MAX(TotalPairs)Pairs from ProdHourlyRep where Date= '" + txtDate.Text + "' and Team='C' group by Line";
- }
- else
- {
- qryAct = "select Line, MAX(TotalPairs)Pairs from ProdHourlyRep where Date='" + DateNow + "' and Team='C' group by Line";
- }
- SqlDataAdapter objAdapter2 = new SqlDataAdapter(qryAct, strConn);
- objAdapter2.Fill(dt2);
- if (dt2.Rows.Count > 0)
- {
- lblActl1.Text = dt2.Rows[0][1].ToString();
- lblActl2.Text = dt2.Rows[1][1].ToString();
- lblActl3.Text = dt2.Rows[2][1].ToString();
-
- }
- }