How do i solve the error that originates from the below code.
DataSet info1 = this.GetData.getInfo("SELECT 0 AS EmpNo,Er.EmpID,(Er.FName&''&Er.LName) AS [Employee Name], Ed.DeptNo AS [Department No],Er.Gender AS [Sex] FROM (EmpRegist AS Er INNER JOIN EmployeeDept AS Ed ON Er.EmpId = Ed.EmpId) WHERE Ed.DeptId=" + (object)DpetID + " AND Ed.Status=0 AND Er.EmpStatus=1 ORDER BY " + str, "EmployeeDept");
if (info1.Tables[0].Rows.Count > 0)
{
for (int index = 0; index < info.Tables[0].Rows.Count; ++index)
//Error Appears on the code below
this.dgvPrint.Rows.Add((object)0, (object)(index + 1), (object)info1.Tables[0].Rows[index]["Employee Name"].ToString(), (object)info1.Tables[0].Rows[index]["Dept No"].ToString(), (object)info1.Tables[0].Rows[index]["EmpId"].ToString());
}
if (this.dgvPrint.Rows.Count > 0)
this.btnPrint.Enabled = true;
else
this.btnPrint.Enabled = false;
}