Results 1 to 3 of 3
  1. #1
    Java.child is offline Member
    Join Date
    Sep 2008
    Posts
    32
    Rep Power
    0

    Default 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?

  2. #2
    jurka is offline Member
    Join Date
    Jul 2008
    Posts
    67
    Rep Power
    0

    Default

    I haven't read your code but you could also use in SQL statement LIMIT 10 condition and LIMIT 10, 20.

  3. #3
    Java.child is offline Member
    Join Date
    Sep 2008
    Posts
    32
    Rep Power
    0

    Default

    As i guess LIMIT command works in My-SQL and I am using MS-SQL.Anyways I don't have any problem with query....query is working perfectly fine......I have problem with code.

Similar Threads

  1. read html code of web page
    By asheeshiit in forum Advanced Java
    Replies: 9
    Last Post: 01-07-2014, 09:31 PM
  2. [SOLVED] retrieve the html code of any web page
    By Omarero in forum New To Java
    Replies: 3
    Last Post: 02-18-2009, 10:20 PM
  3. JNI: Why this code not working?
    By playwin2 in forum Advanced Java
    Replies: 5
    Last Post: 11-25-2008, 01:12 PM
  4. My code is not working properly ..modify it
    By Shyam Singh in forum New To Java
    Replies: 14
    Last Post: 07-16-2008, 05:48 PM
  5. code for number of clicks clicked on a web page???
    By Sveta_cool in forum Advanced Java
    Replies: 2
    Last Post: 02-01-2008, 02:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •