微软的解决办法
usingsystem;
usingsystem.data;
usingsystem.data.sqlclient;
usingsystem.rawing;
usingsystem.windows.forms;
publicclasspagingsample : 양식
{
// formcontrols.
buttonprevbtn = newbutton ();
buttonnextbtn = newbutton ();
staticdatagridmygrid = newdatagrid ();
staticlabelpagelbl = newlabel ();
// pagingVariables.
staticintpagesize = 10; // sizeofviewedPage.
staticinttotalPages = 0; // TotalPages.
staticintCurrentPage = 0; // currentPage.
staticstringfirstvisiblecustomer =; // FirstCustomerOnPagetOdeTerminElocationFormovePrevious.
StaticStringLastVisibleCustomer =; // lastCustomerOnPagetOdeTerminElocationFormoVenext.
// DataSettoBindtodatagrid.
정적화 된 방송 가능;
// initializeConnectionTodatAbaSeandDataAdapter.
STATICSQLCONNECTIONNWINDCONN = NEWSQLCONNECTION (DataSource = LocalHost; IntegratedSecurity = SSPI; InitialCatalog = Northwind);
STANTICSQLDATAADAPTERCUSTDA = NEWSQLDATAADAPTER (, NWINDCONN);
staticsqlcommandselcmd = custda.selectcommand;
PublicStaticVoidgetData (StringDirection)
{
// CreateSqlStatementTorEturnApageOfRecords.
selcmd.parameters.clear ();
스위치 (방향)
{
케이스 :
selcmd.commandText = selectTop+pagesize+customerID, CompanyNameFromCustomers+
wherecustomerid> @CustomerIdOrderByCustomErid;
selcmd.parameters.add (@customerid, sqldbtype.varchar, 5) .value = lastvisiblecustomer;
부서지다;
거세 :
selcmd.commandText = selectTop+pagesize+customerID, CompanyNameFromCustomers+
wherecustomerid <@CustomerIdOrderByCustomerIddesc;
selcmd.parameters.add (@customerid, sqldbtype.varchar, 5) .Value = FirstVisibleCustomer;