I want to display list of names and roll no of students who are studying in nursery stored in my database......But there seems to be an error in following code which i can't figure out
protected void NurseryButton_Click(object sender, EventArgs e)
{
SQLHelper sqhlpr = new SQLHelper();
sqhlpr.SqlText = "Select StudentName,RollNo from tblStudentInfo where Class=@Class";
sqhlpr.AddParameter("Class", sender.ToString());
sqhlpr.ExecuteScalar(false);
DataTable dt = sqhlpr.getDataTable(false);
Label1.Text = dt.Rows[0]["StudentName"].ToString();
}
The error goes like this"There is no row at position 0" in my last line of text i.e.in label1.text. Can anybody help me??