微软的解决办法
نظام الاستخدام ؛
usingSystem.Data ؛
usingSystem.data.sqlclient ؛
usingSystem.drawing ؛
usingSystem.windows.forms ؛
PublicClassPagingsample: Form
{
// FormControls.
buttonPrevBtn = newButton () ؛
buttonnextbtn = newbutton () ؛
StaticDataGridMyGrid = newDataGrid () ؛
StaticLabelPagelBl = newLabel () ؛
// pagingvariables.
StaticIntpagesize = 10 ؛ // sizeofViewedPage.
staticinttoTalpages = 0 ؛ // totalpages.
StaticIntCurrentPage = 0 ؛ // currentpage.
StaticStringFirstVisiBleCustomer = ؛ // firstCustomerOnPageTodEterMinElocationFormovePrevious.
StaticStringLastVisiBlecustomer = ؛ // LastCustomerOnPageTodEterMinElocationFormovenext.
// datasettobindtoDataGrid.
StaticDataTableCusttable ؛
// initializeConnectionTodataBaseAnddataAdapter.
StaticSqlConnectionNwindConn = newsqlConnection (dataSource = localHost ؛ integratedSecurity = sspi ؛ initialCatalog = NorthWind) ؛
StaticsqldataAdapterCustda = newsqldataAdapter (، nwindconn) ؛
staticsqlCommandSelcmd = Custda.SelectCommand ؛
PublicStaticVoidgetData (TrundDirection)
{
// createSqlStateMentToreTurnApageOfRecords.
selcmd.parameters.clear () ؛
التبديل (الاتجاه)
{
casenext:
SELCMD.COMMANDTEXT = SELECTTOP+PAGESIZE+CustomerId ، CompanyNameFromCustomers+
WhereCustomerId> customeridorderbycustomerid ؛
selcmd.parameters.add (@customerid ، sqldbtype.varchar ، 5) .value = lastVisiBlecustomer ؛
استراحة؛
caseprevious:
SELCMD.COMMANDTEXT = SELECTTOP+PAGESIZE+CustomerId ، CompanyNameFromCustomers+
WhereCustomerId <customeridorderByCustomeriddesc ؛
selcmd.parameters.add (@customerid ، sqldbtype.varchar ، 5) .value = firstVisiBlecustomer ؛