微软的解决办法
UNSINGSYSTEM;
ussingSystem.data;
ussingSystem.data.sqlclient;
ussingSystem.Drawing;
ussingSystem.Windows.Forms;
publicClassSpagingsable: Form
{
// Formcontrols.
ButtonPrevBtn = newbutton ();
ButtonNextBtn = newbutton ();
staticDatagridmygrid = newDatagrid ();
staticLabelPagelBl = newLabel ();
// Pagingvariablen.
staticIntpageSize = 10; // sizeofViewedPage.
staticIntotalpages = 0; // Gesamtpagen.
staticIntcurrentPage = 0; // currentPage.
StaticStringFirstvissibleCustomer =; // FirstCustomeronPagetodeterMinelocationFormovePrevious.
StaticStringLastvissibleCustomer =; // lastCustomeronPagetodeterminocationFormovenext.
// Datasettobindtodatagrid.
staticDatatableCustTable;
// InitializeConnectionTodatabaseandDataadapter.
StaticsQlConnectionNWindConn = NewsqlConnection (DataSource = localhost; IntegratedSecurity = sspi; initialCatalog = nordwind);
StaticsQldataAdapterCustda = NewsqldataAdapter (, NwindConn);
StaticsQlCommandselcmd = CustDa.SelectCommand;
publicStaticvoidgetData (StringDirection)
{
// createsQLStatementToreturnapageofRecords.
selcmd.parameters.clear ();
Schalter (Richtung)
{
CASENEXT:
selcmd.commandText = selectTop+pageSize+customerId, CompanyNameFromCustomers+
Wh dascustomerid> @customeridOrderByCustomerid;
selcmd.parameters.add (@customerId, sqldbType.varchar, 5) .Value = lastVisibllecustomer;
brechen;
Caseprevious:
selcmd.commandText = selectTop+pageSize+customerId, CompanyNameFromCustomers+
Wob
selcmd.parameters.add (@customerId, sqldbType.varchar, 5) .Value = firstVisiblecustomer;