Code: stringsqlSelectCount (ID) AsrcountFromTbProductWHEREclassIDIN (+ ids +) ANDPRODUCTNAMELIKE % + @ ProductName + %; OleDbParameter [] spsnewOleDbParameter [1]; sps [0] AccessDB. createParameter (@ ProductName, OleD
The Code is As follows: string SQL = Select Count (ID) As rcount From TbProduct WHERE classID IN (+ ids +) AND PRODUCTNAME LIKE '%' + @ ProductName + '% '; oleDbParameter [] sps = new OleDbParameter [1]; sps [0] = AccessDB. createParameter (@ ProductName, OleD
The Code is as follows:
String SQL = "Select Count (ID) As rcount From TbProduct WHERE classID IN (" + ids + ") AND PRODUCTNAME LIKE '%' + @ ProductName + '% '";
OleDbParameter [] sps = new OleDbParameter [1];
Sps [0] = AccessDB. CreateParameter ("@ ProductName", OleDbType. VarChar, productName, 50, ParameterDirection. Input );
Int resultCount = (int) AccessDB. ExecuteScalar (SQL, sps );
RecordCount = resultCount;
If (resultCount> = 0)
{
If (resultCount % pageSize) = 0)
{
PageCount = resultCount/pageSize;
}
Else
{
PageCount = (resultCount/pageSize) + 1;
}
If (pageIndex = 1)
{
SQL = "Select Top" + pageSize. toString () + "* From TbProduct WHERE classID IN (" + ids + ") and productname like '%' + @ ProductName + '% 'order by ID desc ";
}
Else
{
Int minRecord = (pageIndex-1) * pageSize;
SQL = "Select Top" + pageSize. toString () + "* From TbProduct Where ID Not In (Select ID From (Select Top" + minRecord. toString () + "ID From tbProduct Where classID IN (" + ids + ") and productname like '%' + @ ProductName + '% 'order by ID desc) TemA) and classID IN ("+ ids +") and productname like '%' + @ ProductName + '% 'order by ID desc ";
}
}
Else
{
PageCount = 0;
}
Return AccessDB. ExecuteDataSet (SQL, sps). Tables [0];
,