Share on Google+Share on Google+

chellappa
get data between date from msaccess database
0 Answer(s)      4 years and 6 months ago
Posted in : JSP-Servlet
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>

Ads

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... example which lets you understand to fetch data from database in JSP
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
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
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
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
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
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
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. Please read at http
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
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 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
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
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
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
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
create bar chart in jsp using msaccess database
create bar chart in jsp using msaccess database  type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception
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
Tutorials   
Java Spring Hibernate Struts Training fat image from db fat image from db fat image from db fat image from db unable to get value returned from javascript variable in page How to change image size before adding to mysql using jsp Design a registration.jsp page with input for user registration details Cart Quantity jsp servlet coding issue servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? servlet,jsp login registration forms without database in ecalipse ide using hashmap to store the registraion details ? image pdf marking pdf marking Multiple image upload using JSP Read code from excel sheet and upload into database using JSP Student java about search engine Convert BLOB to PDF and save it to a location how to copy files from remote to local machine using SFTP SSL in java? Like Team viewer Socket and Servert -Jsp how to copy files from remote location to local using java? How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java how to create SOAP based web service in java? how to fetch data from mysql database table and draw a bar chart on that data using in jsp how to create users in LDAP using java? how to authenticate user using TIVOLI api in java? how to create users using IBM Tivoi API in jsp/servelet? Java/J2ee Please explain this code as many packages and classes are unknown to me .! how to download the uploaded folder files using jsp Login Query image is display from path of mysql database please reply the code to store dynamic fields in database? Reloading issue in jsp How to get Button Id ? calling one jap page from another jsp page login login Problem to get connection from DAO class to JDBC Page Loading Time Fix table's column's name row(1st row of the table) so that it does not move up when the table is scrolled up to view more rows below Sending hidden values

Ads

 
Advertisement null

Ads