get data between date from msaccess database

get data between date from msaccess database

here is my code,
                 i want to get data between date using jsp with msaccess.i stored date into database in string.when i got output it displayed before month data also.suppose
i want to get data fromdate ("01-09-2012") to ("04-09-2012), i got output like this
DATE                  NUMBER
01-09-2012              1
02-08-2012              20
03-09-2012              3
04-09-2012              4    
The above output date("02-09-2012") is a sunday.I didn't insert data this date.but before month date("02-08-2012") data to be displayed.how to i prevent that before month data plz help me i need urgently anyone can help me.thanks




<%@ page language="java" import="java.util.*;"%> <%@ page language="java" import="java.sql.*"%>

<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>

      <table width="980px" height="450px" align="center" >

          <tr bgcolor="#7BA6B4" height="50px" >
              <td>
                  <P ALIGN="CENTER"> <font color="darkblue" size="4"><b>BODYYOKE 75% INVOICE</b></font> </P> 
              </td>

          </tr>
          <tr><td></td></tr>


         <tr align="left">
           <td valign="top" >
              <form name="form8">
                  <table  height="170px">





                  <tr>
                     <td>
                         <b><font color="darkblue" size="4">From Date</font></b>
                     </td>
                     <td >
                         <select name="date" style="width: 46px; background:white; border-width: 1px border-color:darkblue; color:darkblue; font-weight: bold; font-size: 14px">
                              <option>dd</option>
                              <option>01</option>
                              <option>02</option>
                              <option>03</option>
                              <option>04</option>
                              <option>05</option>
                              <option>06</option>
                              <option>07</option>
                              <option>08</option>
                              <option>09</option>
                              <option>10</option>
                              <option>11</option>
                              <option>12</option>
                              <option>13</option>
                              <option>14</option>
                              <option>15</option>
                              <option>16</option>
                              <option>17</option>
                              <option>18</option>
                              <option>19</option>
                              <option>20</option>
                              <option>21</option>
                              <option>22</option>
                              <option>23</option>
                              <option>24</option>
                              <option>25</option>
                              <option>26</option>
                              <option>27</option>
                              <option>28</option>
                              <option>29</option>
                              <option>30</option>
                              <option>31</option>

                         </select>

                         <select name="month" style="width: 52px; background:white; border-width: 1px border-color:darkblue; color:darkblue; font-weight: bold; font-size: 14px">
                              <option>mm</option>  
                              <option>01</option>
                              <option>02</option>
                              <option>03</option>
                              <option>04</option>
                              <option>05</option>
                              <option>06</option>
                              <option>07</option>
                              <option>08</option>
                              <option>09</option>
                              <option>10</option>
                              <option>11</option>
                              <option>12</option>

                         </select>

                         <select name="year" style="width: 63px; background:white; border-width: 1px border-color:darkblue; color:darkblue; font-weight: bold; font-size: 14px">

                             <option>yyyy</option>
                             <option>2012</option>
                             <option>2013</option>
                             <option>2014</option>

                         </select>
                     </td>
                   </tr>
              <tr>
                     <td>
                         <b><font color="darkblue" size="4">To Date</font></b>
                     </td>
                     <td >
                         <select name="date1" style="width: 46px; background:white; border-width: 1px border-color:darkblue; color:darkblue; font-weight: bold; font-size: 14px">
                              <option>dd</option>
                              <option>01</option>
                              <option>02</option>
                              <option>03</option>
                              <option>04</option>
                              <option>05</option>
                              <option>06</option>
                              <option>07</option>
                              <option>08</option>
                              <option>09</option>
                              <option>10</option>
                              <option>11</option>
                              <option>12</option>
                              <option>13</option>
                              <option>14</option>
                              <option>15</option>
                              <option>16</option>
                              <option>17</option>
                              <option>18</option>
                              <option>19</option>
                              <option>20</option>
                              <option>21</option>
                              <option>22</option>
                              <option>23</option>
                              <option>24</option>
                              <option>25</option>
                              <option>26</option>
                              <option>27</option>
                              <option>28</option>
                              <option>29</option>
                              <option>30</option>
                              <option>31</option>

                         </select>

                         <select name="month1" style="width: 52px; background:white; border-width: 1px border-color:darkblue; color:darkblue; font-weight: bold; font-size: 14px">
                              <option>mm</option>  
                              <option>01</option>
                              <option>02</option>
                              <option>03</option>
                              <option>04</option>
                              <option>05</option>
                              <option>06</option>
                              <option>07</option>
                              <option>08</option>
                              <option>09</option>
                              <option>10</option>
                              <option>11</option>
                              <option>12</option>

                         </select>

                         <select name="year1" style="width: 63px; background:white; border-width: 1px border-color:darkblue; color:darkblue; font-weight: bold; font-size: 14px">

                             <option>yyyy</option>
                             <option>2012</option>
                             <option>2013</option>
                             <option>2014</option>

                         </select>
                     </td>
                   </tr>

                  <tr>
                      <td colspan="2" >
                          <input type="submit" style="background-color: #000080; color: yellow; font-weight: bold" name="submit" value="SUBMIT">
                          <input type="reset" style="background-color: #000080; color: yellow; font-weight: bold" name="RESET" value="RESET">
                      </td>
                  </tr>


   </table>

    </form>          

<%@ page language="java" import="java.util.*;"%> 
  <%@ page language="java" import="java.sql.*"%>
  <%@ page language="java" import="java.sql.Date"%>
  <%@ page language="java" import="java.text.DateFormat"%>
<%@ page language="java" import="java.text.SimpleDateFormat"%>
<%
                double tivalue8=0.0;


                String date2=request.getParameter("date");
                String month2=request.getParameter("month");
                String year2=request.getParameter("year");
                StringBuffer obj = new StringBuffer();
                obj.append(date2);
                obj.append("-");
                obj.append(month2);
                obj.append("-");
                obj.append(year2);

                String fdate = obj.toString();


                String date11=request.getParameter("date1");
                String month11=request.getParameter("month1");
                String year11=request.getParameter("year1");
                StringBuffer obj1 = new StringBuffer();
                obj1.append(date11);
                obj1.append("-");
                obj1.append(month11);
                obj1.append("-");
                obj1.append(year11);

                String tdate = obj1.toString();

   %>
   <%

              if ( fdate != null  && tdate != null ) 

             {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection con = DriverManager.getConnection("jdbc:odbc:pavithra");
                Statement st=con.createStatement();


                String query ="select * from dateinsert where insertdate>='"+fdate+"' AND insertdate<='"+tdate+"'";

                ResultSet rs=st.executeQuery(query);
                while(rs.next())
                   {

                    String dd=rs.getString("insertdate");
                      int number=rs.getInt("number");

                           out.println(dd);

                          out.println(number);
                          out.println("<br>");
                   }

             }      
%>   

      </table> 
   </body>
</html>
View Answers

Ads









Related Tutorials/Questions & Answers:
get data between date from msaccess database
get data between date from msaccess database  here is my code, i want to get data between date using jsp with msaccess.i stored date into database in string.when i got output it displayed before month data
get data between date using jsp with msaccess
get data between date using jsp with msaccess  hi, urgently i need program for get data between date using jsp with MsAccess database.plz any one can help me.thanks for anyone replay with regards c.b.chellappa
Advertisements
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  Can anybody tell me what is the problem in this code as i am not able to fetch the data from... tutorial go through the link JSP Get Data Into Dropdown list From Database   
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  //Customer Name: <select name="name"> <% try{ Class.forName...="select * from staff"; ResultSet rs=st.executeQuery(sql); while(rs.next
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  Customer Name:<select name="name"> <% try{ Class.forName...=con.createStatement(); String sql="select * from staff"; ResultSet rs
JSP Get Data From Database
JSP Get Data From Database In this section we will discuss about how to get data from database using JSP. To get data from database to a JSP page we... example which lets you understand to fetch data from database in JSP
display date to jsp from database
display date to jsp from database   display date to jsp from database... not available in database field than show in green color and clickable. NOTE :- Date which is available in Between Start date & End Date also show red color and non
How to get the data from the database using Servlet or JSP program
How to get the data from the database using Servlet or JSP program  ... the problem   Get data from database using servlet Retrieve data from database using JSP Get data from database using JSP
How to get the most recent data from the sql database
How to get the most recent data from the sql database  Hi, just wanted to show the most recent row from the database table...in my web page. for example if i have four records in the table that was added on different different
How to get data from Oracle database using JSP
How to get data from Oracle database using JSP  hello i have a simple problem in jsp in the sense to get data from the database like oracle . I have... in the sense to get data from the database like oracle . I have created one jsp
get information from database
get information from database  get information from database   Please visit the following links: http://www.roseindia.net/sql/mysql-table/mysql-php-select.shtml http://www.roseindia.net/sql/mysql-example/select
How to get day from date in SQL?
How to get day from date in SQL?  Hi, How to get day from date in SQL? For your information I am working on the MySQL database. Thanks   Hi, You can use the following queries to get the data: select date_format(now
Need to get the Data based on Date
Need to get the Data based on Date  Hie , I am having a criteria where i need to get the data based on date . I have written the query as "from... and has values as 2011-01-10 11:14:36.000000 . But i am getting the date from my
post ,get data in the database
post ,get data in the database  post ,get data in the database  Please visit the following links: PHP get post data PHP Tutorials
get values from Excel to database
get values from Excel to database   hi i want to insert values from Excel file into database.Whatever field and contents are there in excel file that should go to database which exists. am using SQL Server management studio
JDBC : Get year from Date
JDBC : Get year from Date In this section, you will learn how to get year from date. Get year from Date : In MySql you can get year from the given Date... static void main(String[] args) { System.out.println("Get year from date
date between
to select records between 2 dates, I use this query: Select * from table1 Where date...date between  Hi Iâ??ve wrote a program by Delphi 7, Iâ??ve used an Access database and SQL, and also in my tables I have some fields. One
How to get the data from the database (Oracle) in console or in ie using servlet or jsp as Front end
How to get the data from the database (Oracle) in console or in ie using... in the sense to get data from the database like oracle . I have created one jsp...","tiger"); ResultSet rs=ps.executeQuery("select from Table1"); if(rs.next
retrive data from database
retrive data from database   hi.. i made a application form. it's have attribute s.no,name,roll no and i enter a few records. now i want to view all record not in database access sheet i want to view it at any another
retrive data from database?
retrive data from database?  hellow i have a database sheet name as db1. it's contain sixty(60) sn,name ,rollno(primary key),father's name etc... from db1 and enter value in text box according there name,rollno and save
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
fetch data from database in javascript
fetch data from database in javascript   How to fetch data from database in JavaScript when it is a leap year
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
Retrieve date from MYSQL database
Retrieve date from MYSQL database In this tutorial, you will learn how to retrieve date from database. Storing and Retrieving dates from the database... the SQL statement to the database. Here, we are going to retrieve the date
JSP Get Data Into Dropdown list From Database
JSP Get Data Into Dropdown list From Database In this section we will discuss.... This tutorial explains you that how to fetch data from database and set... data from the database and set it into the dropdown list in JSP using MySQL
how to get date format in string from date object containing real date in java
how to get date format in string from date object containing real date in java  i want to get data string format from date object where date object containing real date. date frequently vary in from of only month & year
how to get date format in string from date object containing real date in java
how to get date format in string from date object containing real date in java  i want to get data string format from date object where date object containing real date. date frequently vary in from of only month & year
How to get month name from date(like-25/06/2012) using java?
How to get month name from date(like-25/06/2012) using java?  How to get month name from date(like-25/06/2012) using java
how to retrieve data from database
how to retrieve data from database  unable to retrieve data from database using mySQL by using jsp sessions and beans for editing

Ads