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









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
Get date data type from table
GET DATE DATA TYPE FROM TABLE In this example , we will get "Date" data type from a table of "Mysql" database and it also display...=st.executeQuery("selectname,DOBfromstudentwherename='Ankit'"); while
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... giving a simple example which lets you understand to fetch data from database
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 the data from database - Java Server Faces Questions
how to get the data from database  In database i have created some tables(person details) and i have one jsf page in that one search button is there if i enter first 3 digits of a name and click on the search button it should
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
how to get the data from database&how to display the database data in jsf - Java Server Faces Questions
how to get the data from database&how to display the database data in jsf  Hi, 1.how to get the data from database. 2.how to display the database...; Hi friend, To Solve the Problem get the data from database
selecting data from database
selecting data from database  how to select data from database using Dao in struts   Hi, You have to load the data from database using hibernate and send the data in a Java file object to jsp page.ADS_TO_REPLACE_1
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
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
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 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
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
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
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
how to retrieve data from database ?????/
how to retrieve data from database ?????/  how to retrieve data from database
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... for fetching data from the database and set it into the dropdown list in JSP
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
To retrive data from database - Struts
To retrive data from database  How to get values ,when i select a select box in jsp and has to get values in textbox automatically from database? eg... come to jsp page automatically from database
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
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... to retrieve the date of birth of persons from the database table. For this, we have
delete data from database - SQL
delete data from database  HOw to delete specific data from table> I want to delete one record from database. Thnx  Hi friend, -------------------------------------------- Visit for more information
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
Problem in accessing data from Database
Problem in accessing data from Database  hi..... i'm making a project on servlet and jsp with ms access 2007 at the backend. One field in my database is text and all others are of currency data type. If i enter 0 or null value
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...) { System.out.println("Get year from date Example..."); Connection conn = null; String
retrieve data from database with hyperlink
retrieve data from database with hyperlink  sir....i have one table called 'name' having two values i have to retrieve those data with a hyperlink and show in browser and if we click hyperlink its shows his sub categories....how
Getting Textbox data from database
Getting Textbox data from database  When i m trying to get data in textbox as readonly from database i m getting following error.and my code is shown... data from database and display it on the textboxes. <%@page language="java
retrieve data from mysql database
retrieve data from mysql database  hi am not familiar in php.....even... selected value on combobox which is to be retrieve the relevant data from mysql database using php.... below my code is that.. <html> <head>
Data retrieve from mysql database
from the dropdown, related data will get displayed on the textboxes. Here we have...Data retrieve from mysql database  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list
Getting Textbox data from database
Getting Textbox data from database  When i m trying to get data in textbox as readonly from database i m getting following error.and my code is shown...;Here is a jsp code that retrieves data from database and display
how to display data from database in jsp
how to display data from database in jsp  how to display data from database in jsp
retreive integer data from database
retreive integer data from database  i made a table named result...=lalit&database=mydb"); String url="select marks from student where rollno... and two buttons "ok" and "cancel" i want to take input from textfield
SQL Date Between
SQL Date Between       Mysql Date Between return the date between the two existing date... 'Date Between in SQL'. To understand this example we create a table 'Employee1
GWT -- retrive the data from Database
GWT -- retrive the data from Database  the user can create an event. In the create page, we have three buttons. Save as draft, preview and save... button, you have to create a dynamic jsp which should read the contents from
create bar chart in jsp using msaccess database
create bar chart in jsp using msaccess database  thanks for reply, that code i can use but i get the below error, pls help me message description The server encountered an internal error () that prevented it from
Retrieval data from database against timer
Retrieval data from database against timer  Please send me a sample timer code which retrieve data from the database against timer in JSP
data insertion from xml file to database table
data insertion from xml file to database table  Hi all, I have data in the XML file. I need to insert it into table in the database using servlet. so please reply me . ThankYou
how to use bean to retrieve data from database
how to use bean to retrieve data from database  how to use bean to retrieve data from database   poda sendru
How To Fetch Data From Database Into JTextArea
How To Fetch Data From Database Into JTextArea In this section we will read about how to get the data from database table into JTextArea.... The getOperation() method I have defined for fetching the data from database and set
Retrieve data from database in swing application
Retrieve data from database in swing application  I want to retrive data(doctor name,specilization,date) from my sql database...(); ResultSet rs=st.executeQuery("select * from data where id=1"); while

Ads