Next Page Code is not working
Hello Experts,
Suppose I have 50 records then I want only ten records per page.
I wrote the following code to go to the next page.But this code is not working.
private void Next_Click()
{
try
{
int count ;
rst = dbs.openRecordset("SELECT COUNT(*) FROM CRVMReq where ReqStatusPool NOT like 'FOCUS' and ReqStatus"+
"like 'OPEN' and ReadyTD='YES' "+
"", AdoConst.adOpenDynamic, 0 );
count=rst.getRecordCount();
if(count>10)
{
int num_of_click_next = count/10 ;
int x= 1 ;
int y = 10;
while (num_of_click_next >= 1 )
{
num_of_click_next =num_of_click_next -1;
x = x + 10 ;
y = y + 10 ;
dataListCRVM.setRecordSource( "SELECT * FROM (SELECT row_number() OVER (ORDER BY Priority desc,date desc) AS rownum,"+
"ReqID,ClientReq,ResumeSample as RS,Priority,Subject,ByPass,ConsultantNames ,Rec1,Rec2,Note,Client" +
"FROM CRVMReq WHERE ReqStatusPool NOT like 'FOCUS' and ReqStatus like 'OPEN' and ReadyTD='YES' ) AS A " +
"where A.rownum BETWEEN (x) AND (y);");
}
Data.initControls(dataListCRVM);
ListCRVM.setRowSource(dataListCRVM);
ListCRVM.setVisible(false);
ListCRVM.setVisible(true);
JInternalFrame[] frames =GetRIdSubF.getAllFrames();//I guess problem is at this point.Is it required to upload the page again?
if (frames.length>0){
for (int i = 0; i < frames.length; i++)
{
frames[i].setClosed(true);
frames[i]=null;
}
}
GetRIdSubF.setVisible(true);
CRVMTriageUpdate jInternalFrame1=new CRVMTriageUpdate();
javax.swing.plaf.InternalFrameUI ui = jInternalFrame1.getUI();
((javax.swing.plaf.basic.BasicInternalFrameUI)ui). setNorthPane(null);
GetRIdSubF.add(jInternalFrame1);
GetRIdSubF.setDragMode(1);//LIVE_DRAG_MODE;//LIVE_DRAG_MODE
jInternalFrame1.setVisible(true);
jInternalFrame1.setDefaultCloseOperation(JInternal Frame.DISPOSE_ON_CLOSE);
jInternalFrame1.setSize( 1160, 467 );
}
else
{
dataListCRVM.setRecordSource( "SELECT [CRVMReq].[ReqId],[CRVMReq].[ClientReq] as Client Req Id,[CRVMReq].[ResumeSample] as RS,[CRVMReq].[Priority], [CRVMReq].[Subject],[CRVMReq].[ByPass], [CRVMReq].[ConsultantNames] as [ConsultantNamesAll],[CRVMReq].[Rec1],[CRVMReq].[Rec2], [CRVMReq].[Note] FROM CRVMReq " +
"WHERE ReqStatusPool NOT like 'FOCUS' and ReqStatus like 'OPEN' and ReadyTD='YES' order by [Priority] DESC , [Date] DESC;" );
Data.initControls(dataListCRVM);
ListCRVM.setRowSource(dataListCRVM);
ListCRVM.setVisible(false);
ListCRVM.setVisible(true);
JInternalFrame[] frames =GetRIdSubF.getAllFrames();
if (frames.length>0){
for (int i = 0; i < frames.length; i++)
{
frames[i].setClosed(true);
frames[i]=null;
}
}
GetRIdSubF.setVisible(true);
CRVMTriageUpdate jInternalFrame1=new CRVMTriageUpdate();
javax.swing.plaf.InternalFrameUI ui = jInternalFrame1.getUI();
((javax.swing.plaf.basic.BasicInternalFrameUI)ui). setNorthPane(null);
GetRIdSubF.add(jInternalFrame1);
GetRIdSubF.setDragMode(1);//LIVE_DRAG_MODE;//LIVE_DRAG_MODE
jInternalFrame1.setVisible(true);
jInternalFrame1.setDefaultCloseOperation(JInternal Frame.DISPOSE_ON_CLOSE);
jInternalFrame1.setSize( 1160, 467 );
}
}
catch(Exception _e_) { Err.clear();Err.set(_e_,"Next_Click"); }
}
Suggest me what to do?