我有这个功能,可以将数据库中的记录显示到 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);
}
}
}
我将如何限制将在 flowlayoutpanel 中显示的记录数?我知道有 select top 。但是我将如何做到这一点,例如将显示 10 条记录,当单击下一个按钮时,将显示下一个 10 条记录,当单击上一个按钮时,将显示前 10 条记录。