I have this function that display records from the database to flowlayoutpanel
flowLayoutPanel1.Controls.Clear();
using (SqlConnection myDatabaseConnection = new SqlConnection(myConnectionString.ConnectionString))
{
myDatabaseConnection.Open();
string a = "Select EmpID, Name from EmpTable";
using (SqlCommand SqlCommand = new SqlCommand(" "+ a +" ", myDatabaseConnection))
{
int i = 0;
SqlDataReader DR1 = SqlCommand.ExecuteReader();
while (DR1.Read())
{
i++;
BookUserControl usercontrol = new BookUserControl();
usercontrol.Tag = i;
usercontrol.EmpID = DR1["EmpID"].ToString();
usercontrol.Name = (string)DR1["Name"];
flowLayoutPanel1.Controls.Add(usercontrol);
}
}
}
How i will limit the number of records that will be display in the flowlayoutpanel? I know there is select top . But how I will do this, for example a number of 10 records will be display and when a nextbutton is click the next 10 records will be display and when a previousbutton is click the previous 10 records will be display.