Monthly  search &  how to display 15 records per page with next & back btn

hi
i m trying to find records using select statement.
i want to get record pagewise. its a simple code. i m sending
plz if anybody have any solution or suggestion try to solve it out
one more thing i have a field in my database as a date.
i want a monthly search. what will be query.
i'll be thankful 4 any help
regards
<html>
<head>
<title>search</title>
</head>
<body>
<body bgcolor="#B0C4DE">
<%@ page language="java" import="java.sql.*"%>
<form>
<table width="45%">
<%
    String param = request.getParameter("Str");
    if(param == null)
       param="";
%>
        <td width="128"><font color="#800080"><h3>Enter Date</h3></font</td>
          <td width="150">
          <input type="TEXT" name="Str" size="15" />
          <form action="menu01.jsp" method="post" name="ser_chk1.jsp"></td>
          <td>
        <BUTTON name="post" type="submit"><img src="m162.gif" width="25" height="25" border="" alt="Search Now" /></BUTTON></td>    
</form>      
</tr>
</table>
</form>
<%  
  if(!param.equals("")) {
   Connection con = null;
   ResultSet rs = null;
   PreparedStatement pstmt = null;
  try
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      con = DriverManager.getConnection("jdbc:odbc:database");
      String sql = "SELECT * FROM data, data1  WHERE gate_pass=gate_pass1 AND ser_no=ser_no1 AND nat_ure=nat_ure1 AND ven_dor=ven_dor1 AND sou_rce=desi_g1 AND desi_g=sou_rce1 AND d_o_s LIKE ?";
      pstmt = con.prepareStatement(sql);
      pstmt.setString(1, param);
      rs = pstmt.executeQuery();  
%>
<table border="" width="1200">
<tr>
        <th><font color="#800080">Serial No</font></th> 
        <th><font color="#800080">Nature</font></th>
        <th><font color="#800080">Description</font></th>
        <th><font color="#800080">Problem</font></th>       
        <th><font color="#800080">Vendor</font></th>
        <th><font color="#800080">Employee No</font></th>
        <th><font color="#800080">Employee Name</font></th>
        <th><font color="#800080">GatePass</font></th>
        <th><font color="#800080">Return Status</font></th>
        <th><font color="#800080">Source</font></th>
        <th><font color="#800080">Desigation</font></th>
        <th><font color="#800080">Source Out</font></th>
        <th><font color="#800080">In Desi</font></th>
        <th><font color="#800080">Vendor In</font></th>
        <th><font color="#800080">Vendor Out</font></th>
        <th><font color="#800080">Back Desi</font></th>
        <th><font color="#800080">Employee No</font></th>
        <th><font color="#800080">Employee Name</font></th>
        <th><font color="#800080">Remark</font></th>      
</tr>
<%
       while(rs.next()) {
      String serno = rs.getString("ser_no");
      String nature = rs.getString("nat_ure");
      String description = rs.getString("desc_i");
      String problem = rs.getString("prob_lem");
      String vendor = rs.getString("ven_dor");
      String empno = rs.getString("emp_no");
      String empname = rs.getString("emp_name"); 
      String gatepass = rs.getString("gate_pass");
      String retsts = rs.getString("ret_sts");
      String source = rs.getString("sou_rce");
      String desi = rs.getString("desi_g");
      String dos = rs.getString("d_o_s");
      String did = rs.getString("d_i_d");
      String vrd = rs.getString("v_r_d");
      String rfv = rs.getString("r_f_v");
      String dtd = rs.getString("d_t_d");
      String empno1 = rs.getString("emp_no1");
      String empname1 = rs.getString("emp_name1");
      String remark = rs.getString("re_mark1");
%>
<tr>
    <td><%= serno %></td>
    <td><%= nature %></td>
    <td><%= description %></td>
    <td><%= problem %></td>
    <td><%= vendor %></td>
    <td><%= empno %></td>
    <td><%= empname %></td>
    <td><%= gatepass %></td>
    <td><%= retsts %></td>
    <td><%= source %></td>
    <td><%= desi %></td>
    <td><%= dos %></td>
    <td><%= did %></td>
    <td><%= vrd %></td>
    <td><%= rfv %></td>
    <td><%= dtd %></td>
    <td><%= empno1 %></td>
    <td><%= empname1 %></td>
    <td><%= remark %></td>
</tr>
<%
    finally {
              if (rs != null) rs.close();
              if(pstmt != null) pstmt.close();
              if (con != null) con.close();
%>
</table>
</body>
</html>

Hi Shi_san
for monthly search you can use the below query..
String qry="Select * from tablename where datefield is between '"+value1+"'" and '"+value2+"' ;for Value1 and Value2 you need to put two fields in your form....and user has to enter value like mm/dd/yyyy .....if you don't want to do that then put one option for user which month he wants to see the data...if user select month March then select value1=03/01/2006 and value2=03/31/2006...something like that...
now for Next and Back button you must be having uniqueID in your table,,,
First Time display this query.....
String disprec="Select Top 15 *  from table1 order by uniqueID DESC ";now you need to retrieve last record's value from this page and pass it into you link of Next Button....
If you click next button then display below query....
String disprec="Select Top 15 *  from table1 where uniqueID<val1 order by uniqueID DESC ";c if it works...
Vishu

Similar Messages

  • How to divide record per page (20 record per page).

    How to divide record per page (20 record per page).
    I try word (limit) example
    "select * from table1 where [ some_condition]
    limit [start], [end] "
    , but it error.

    Tom Kyte has a rather extensive discussion of paging techniques here: http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Limit records per page with Report Builder?

    Is there a way with the report builder to limit the number of
    records per
    page? Thanks.
    ...Brad

    I guessing here but there must be a bit of php code that you can edit that limits the number of records to be displayed instead of the default value of 10.

  • How to Control with Maximum Record per Page

    Hi Every one
    how can I control with maximum record per page with parameter sending from Form
    ex.
    if I set parameter with value=15 the report will run 15 rows per page ?
    Can anyone help me Please ASAP ?
    Thankx

    PLay around with SRW.SETMAXROW , from memory that should do the trick.
    Cheers.
    N.

  • How to display 20 records per page in jsp

    Hi All,
    I have table contains 1000 records. How can i display 20 records per page using jsp.
    can anyone help...

    hi, I am unable to use the ejb in my jsp page. Really? Then why not ask a question in the JSP or EJB forum?
    I want
    the output of my ejb in jsp page.
    if possible please suggest me .Do you? Whats the output? What are you trying to do? Where's your code? What's the problem? Have you even bothered to read the tutorial?
    >
    thanxNo, thank you....
    ....for posting another non-sensical useless post in the wrong forum

  • Displaying 10 records per page

    hi,
    somebody please help me.....
    i have a list of more than 20 records which i get
    from database and then i put it in session.
    i have to display 10 records per page only and
    on the same page i'd like to have links to page
    numbers to view next set of records.
    example is how googel displays its search results.
    ex. [ 1 2 3 4 5 ]
    THANKS A LOT!

    this can be done using the pagination technique.
    [email protected]

  • Restricting to Display 2 records per page simulteneously in Graph & Report

    Hi
    I am calling a column chart from Report using custom Query and I am mapping the Chart Column property in Report respectively to the chart.
    The Repeating frame with respect to the Reports Records 'Max. records property' is set to 2. Hence the chart and the Report records are on the 3 pages as the Total records are 6.
    But the chart is plotting all the 6 records even though the Report populates only 2 records per page. I require it to plot only respective records of the Report for that page in the chart not all the 6 records.
    Pl. let me know how to Proceed
    Thanks
    Prakash H L

    akshatha wrote:
    i am doing small project in jsp there i have search engine
    if you type anything into the search textbox( either number or character) and the search result should display 10 records per page and the 11th records should go to the next page.
    i have 3 files i search data from the database through array list in servlet and forwarded to the jsp page .
    in jsp page i require 3 buttons thery are print, next and previous.You need paging. Helpful Google keywords will be "paging", "pagination" in combination with "jsp". Try it.
    In a nutshell: just remember 2 variables: the first row to be displayed and the row count to be displayed at once. Add at least 2 buttons which changes those variables. The Next button which increments the first row value with the row count value. The Previous button which decrements the first row value with the row count value. Fairly straightforward. If you unfortunately find it hard somehow, consider a 3rd party paging tag library, such as Displaytag. Google can find it either.
    The print button can be just a plain dumb button with only Javascript's window.print() in its onclick attribute.
    i am giving piece of code
    if anybody knows please correct it or Almost nobody here is going to read an unformatted piece of code nor going to fix it. Use code tags and ask questions the smart way.

  • Display 20 records per page -- Pls help

    I am using sql query which returns some 1000 records, i have to display 20 records per page. I am using an enterprise bean that has finder method which returns arraylist of records. From this arraylist i am displaying in the JSP page. If after selection, if other user updates in the database, This won't reflect in the jsp page. How should i go about?

    oops,
    Implementing a Data Cache using Readers And Writers
    By Billy Newport, EJB Consultant
    http://www.theserverside.com/resources/article.jsp?l=Readers-Writers
    You may have come across a situation where you need to cache some data in your server. You then use this cache to service queries from incoming requests. You will also probably have a thread that listens for cache update events. This thread updates the cache in response to these events.
    This leads to a problem as it's unlikely that both the threads servicing requests and the update thread will be able to use your cache simultaeneously. You may be tempted to use an exclusive lock such as a Java synchronised block to handle this. This will work but it is probably the worst way that you can do this from a performance perspective. This articles shows how you can use reader writer locks to accomplish the same thing using a much more efficient technique.
    Reader writer locks.
    How to detect changes to the database?
    We can place triggers on a table. These triggers can call a stored procedure when-ever a record is updated/inserted or deleted. If we are caching the data in our application server then obviously when this happens we will want to know about it. We can split databases in to two categories when we look at implementing this. Oracle and everybody else.
    Oracle 8i
    Oracle is the most elegant. I'm assuming you're using Oracle 8i. Oracle 8i has a builtin JMS mechanism. We can define a queue in Oracle. Our pl/sql (or Java) stored procedure gets attached to the trigger. The stored procedure enqueues a message on the Oracle queue. The message would describe the event that happened. Our application servers will run a thread inside the application server VM that subscribe to and then listen to this queue. When a legacy system or an application server modifies the database then our triggers will call this stored procedure. It then enqueues the message. If the transaction is commited then the message is commited and sent to the listeners. If the transaction is rolled back then it is not commited and not sent. If the transaction is commited then all our application servers will receive the message. They can then use the message contents to see what happened and update the cache accordingly.
    Oracle 8 includes a full JVM. You could as an alternative use a Java stored procedure to multicast the event or send the event any way you choose. This isn't possible using Sybase or DB2 as they don't include the java.net package in the VM inside the database.
    If you're using an older version of Oracle then there is a way to send messages over an Oracle connection from the server to a client. Check your OCI manual for details. This message will be sent though regardless of the transaction outcome unlike the Oracle AQ solution.

  • Display 20 records per page

    i want to do one stuff....
    i retrieved database data using below satement......
    i want to display 20 records per page...and per page having two image of next and back..when i click to next ..it displays next 20 records...vice versa...
    PreparedStatement sql = conn.prepareStatement("select * from pay_header");

    Hello abhit,
    If you don't know how to use tag libraries, you can do it ur own.
    Just take your data in a List or Vector.
    Keep two hidden fields with the startIndex as 0 and endIndex as 20.
    update this values as 20 and 40 respectively after first iteration.
    Now for each button click prev or next ,update ur loop control values as such there in the hidden fields.
    use while loop and a boolean variable to indicate backward or forward moving. ok
    If you are using this approach and want to know how to more please let me know.
    Enjoy.......
    kuttus

  • Data Merge, its is possible to display 5 records per page?

    I have no problem doing data merges.  They always seem to only show one record per page, but is there a way to be able to display more records per page?

    Read the help for a full explanation, then come back here with specific questions if you still have problems...
    Basically, you set up a single instance of field placeholders on you page, then select multiple records per page in the merge options. You cannot specify a number directly, but ID will reprduce as many records on the page as all elements will fit using the spacing settings you set up, so you might want to add an empty frame the size required to get your five instances with zero spacing and group it with the field tags.

  • How to restrict no of records per page in script

    Hi Experts,
    I am working on SAP Scripts and I am having one problem I need to restrict 15 records per page.
    Please help me out.
    LOOP AT  IT_ITAB
    Call function WRITE_FORM
    ENDLOOP.
    Is there any ways to restrict in loop?
    Thanks in advance
    Basu

    Inside the loop,
    after the write_form give the following if condition
    loop at itab.
    ...write_form...
    w_count = sy-tabix MOD 15.
    if w_count eq 0.
    CALL FUNCITON 'control_form'
    COMMAND = 'NEW-PAGE' .
    endif.
    endloop.
    Regards
    Sharath

  • IN XML PUBLISHER REPORT WHICH SHOWS 5 RECORDS PER PAGE REG:-

    {color:#0000ff}Dear All,
    Conditionally, i want my XML Report has to be Display only 5 Records per Page..
    If there are hundreds of records in XML file.
    Please, could u help me out..
    Waiting for ur reply..
    Regards,
    Sarfraz.
    {color}

    For 11i, pl see the XML Publisher User Guide at http://download.oracle.com/docs/cd/B25516_18/current/html/docset.html on how to achieve this
    HTH
    Srini

  • Limit records per page in the horizontal looper?

    Might sound confusing, but I'm wondering if/how I can use the horizontal looper to show 30 records per page?
    For example, I have a photo thumbnail collection. I want to show 5 columns and 10 rows. Is there a way to get the looper to put a link to the 'next 50' so the user can see the next 50 thumbnails (starting at thumbnail 51 of course)?
    thanks

    I guessing here but there must be a bit of php code that you can edit that limits the number of records to be displayed instead of the default value of 10.

  • I want to diaplay my records from the databasewith 10 records per page. i l

    i want to diaplay my records from the databasewith 10 records per page. i learned that it can be done through pagination . Please can anyone there help me and give me the code of how to page my records in my jsp pages
    I have small code ,but its not working....
    below is the code....
    public ResultSet codeResult(int i){
    if(dataSource!= null){
         try {
                             con=dataSource.getConnection();
         stmt=con.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
         int maxRows=stmt.getMaxRows();
         System.out.println("the maxRows is:"+maxRows);
         System.out.println("the I value is:"+i);
         if((i < 0) || (i > maxRows)){
              i=0;
         stmt.setFetchSize(i);
         long t = System.currentTimeMillis();
         rs=stmt.executeQuery("select asc_code,countrycode,asc_name,asc_address1,asc_address2,asc_city,asc_country,asc_region,asc_contact_person,asc_contact_no,asc_email_id,asc_fax_no,nso_incharge,nso_email,ar_ap_code from asc_master order by asc_code asc");
    but,its giving all records...
    any one help me on this........
    Thank you,
    D.Nagireddy.                    
                        } catch (SQLException e) {
                             e.printStackTrace();
              return rs;
              }

    hey, here my code for paging. hope it helps...
         public void DueRecordInfo(int page,int MAX_PER_PAGE)
              con = new DBConnection().getConnection();
             try
                     Statement stmt = con.createStatement();
                     String sqlcount = "SELECT COUNT(*) FROM INFO WHERE TO_DATE(DATEUPDATED,'Month DD, YYYY') < ADD_MONTHS(SYSDATE,-6) AND OBSOLETE LIKE 'No'";
                     ResultSet rscount = stmt.executeQuery(sqlcount);     
                    rscount.next();
                    total_row_count = rscount.getInt(1);
                  lowerbound = (page * MAX_PER_PAGE - (MAX_PER_PAGE))+1;
                  upperbound = lowerbound - 1 + MAX_PER_PAGE;
                  String sql = "Select * from "+
                                    "(SELECT row_number() over(ORDER BY TO_DATE(DATEUPDATED,'Month DD, YYYY') DESC) AS RN,ID,SPECNO,REVISEDNO,DATEREVISED,TITLE,ORIGINATOR,DCBNUMBER,DCBLOCATION,OBSOLETE,DATEOBSOLETE,WORDFILE,PDFFILE,DATEUPDATED FROM INFO WHERE TO_DATE(DATEUPDATED,'Month DD, YYYY') < ADD_MONTHS(SYSDATE,-6) AND OBSOLETE LIKE 'No') " +
                                    "WHERE RN BETWEEN "+ lowerbound + " AND " +upperbound;
                   ResultSet rs = stmt.executeQuery(sql);
                  while (rs.next())
                         id.add(num, rs.getString("ID"));
                         specno.add(num, rs.getString("SPECNO"));
                         revisedno.add(num, rs.getString("REVISEDNO"));
                       daterevised.add(num, rs.getString("DATEREVISED"));
                       title.add(num, rs.getString("TITLE"));
                       originator.add(num, rs.getString("ORIGINATOR"));
                       dcbnumber.add(num, rs.getString("DCBNUMBER"));
                       dcblocation.add(num, rs.getString("DCBLOCATION"));
                       obsolete.add(num, rs.getString("OBSOLETE"));
                       dateobsolete.add(num, rs.getString("DATEOBSOLETE"));
                       wordfile.add(num, rs.getString("WORDFILE"));
                       pdffile.add(num, rs.getString("PDFFILE"));
                       dateupdated.add(num, rs.getString("DATEUPDATED"));
                         num++;
                   con.close();
                   rscount.close();
                   rs.close();
                   stmt.close();
             }

  • Limit the number of records per page in webi

    Hello All,
    How do i limit the number of records per page in webi?
    i was asked to have not more than 20 records per page.
    In " NUmber of Vertical records per page"(Quick display mode) the default value was 100, i am trying to set it to 20 ...but its not updating....its still taking 100.
    I am on BO XI 3.1 Sp2 fix pack 3
    Please let me know a way to accomplish this.Any inputs appreciated
    Thanks

    It can be done as follows:
    1. create a variable at report level as:
            v Test = Floor(RowIndex()/20)
    2. Added this variable in the Block as a new column.
    3. Select the v Test column, Right Click and set as section (also you can apply break).
    4. Go to structure mode select section\break and go to properties tab and select the property "Start on new page".
    Regards,
    Rohit

Maybe you are looking for

  • Tilt-Shift Effect

    How to create a Tilt-Shift Effect with Photoshop Touch Create the impression of a miniature landscape with this popular photographic technique. 1. After selecting the "Tilt-Shift Effect" tutorial, press "Begin Tutorial" to start. Choose Adjustments >

  • Photoshop and Iphoto issues

    I downloaded Photoshop Elements and now when I ope IPhoto I can no longer use the quick fix buttons. Elements immediately opens and I have to import the photo to do anything to it, even rotate it. Do I need to take Photoshop off my computer and put i

  • Movie trailers app has no audio

    I'm not getting any audio from Apple's movie trailers app - unless I'm using headphones. Otherwise, nothing. Anyone else have this issue, as well?

  • Connection Lyinksys srw with IOS 1.0.2 with Rancid

    Hi all!! I want to modify an already existing script that was used to connect to a Linksys switch 1.0.4. or the switch I have are version 1.0.2 and it is impossible to put to update. Here is the script version 1.0.4 is the csblogin here The differenc

  • Can't open projects or text template created in Ae cc with Pr cc

    Hi. I am new to After Effects (and pretty new to Premiere after converting from FCP7). I have edited a project in Premiere, have exported it into After Effects, added some text animation and now want to bring it back into Premiere. I have exported a