我有這個功能從數據庫中顯示記錄到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中顯示的記錄數?我知道有選擇頂部。但是,我將如何做到這一點,例如將顯示10條記錄,當點擊下一個按鈕時,將顯示接下來的10條記錄,當前一個按鈕點擊時,將顯示前10條記錄。
什麼是數據庫? Oracle,Sql Server 2000/2005/2008? – unlimit
幫助? http://stackoverflow.com/a/658570/1134076 –
sql server 2008 :) –