I need your help to finish my project.
i am doing project with jsp and oracle10g.
here the following files i attached here. please try this and solve my prob.
" in jsp 'insert.jsp' i want to use the two text box which can be fillup by the user from and to date.
after that .. it has to interact with the database . (have several columns). particularly i want to get it..PUNCH_DATE column.
i do know how to fetch the dates with the database by a query..
Note:
there is optional in user giving date..
1. i need month and year drop down box
2. if not possible (drop down box) go for the two text box
try{
//for oracle
//String query="select * from bhel where empcode='"+no+"' and PUNCH_DATE between '01-"+dt+"' and '31-"+dt2+"'";
//String query="select * from act_stipend where EMPCODE="+no+" and MYDATE="+to_date('d1','dd/mm/yy')+"";
//String query="select * from bhel where empcode='"+no+"' and PUNCH_DATE='"+dt1+"'";
//String query ="SELECT * FROM bhel WHERE EMPCODE='"+no+"' and PUNCH_DATE BETWEEN '"+to_char(' "+dt1+" ', 'dd/mmm/yy')+"' AND '"+to_char (' " +dt2+" ', 'dd/mmm/yy')+"' ";
String query ="select * from bhel where empcode=" "'"+no+"'" and punch_date +" between to_date(' "+dt1+" ' ,'dd/mmm/yy ') and to_date(' " +dt2+ " ' , 'dd/mmm/yy ')";
String url="jdbc:oracle:thin:@localhost:1521:XE";
Class.forName("oracle.jdbc.driver.OracleDriver");
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//for oracle
Connection con =DriverManager.getConnection(url,"system","gana");
//for access
//Connection con =DriverManager.getConnection("jdbc:odbc:NovemberAPA");
SQL> desc act_stipend
Name Null? Type
------------------------------- -------- ----
EMPCODE NOT NULL VARCHAR2(7)
EMPNAME VARCHAR2(30)
PUNCH_DATE NOT NULL DATE
SHIFT1 VARCHAR2(2)
IN_PUNCH1 VARCHAR2(5)
OUT_PUNCH1 VARCHAR2(5)
SHIFT2 VARCHAR2(1)
IN_PUNCH2 VARCHAR2(5)
OUT_PUNCH2 VARCHAR2(5)
ABS_HRS VARCHAR2(5)
SHORT_ABS VARCHAR2(5)
HA1 VARCHAR2(2)
HA2 VARCHAR2(2)
COFF DATE
create table bhel(
EMPCODE VARCHAR2(7) NOT NULL,
EMPNAME VARCHAR2(30),
PUNCH_DATE DATE NOT NULL ,
SHIFT1 VARCHAR2(2),
IN_PUNCH1 VARCHAR2(5),
OUT_PUNCH1 VARCHAR2(5),
SHIFT2 VARCHAR2(2),
IN_PUNCH2 VARCHAR2(5),
OUT_PUNCH2 VARCHAR2(5),
ABS_HRS VARCHAR2(5),
SHORT_ABS VARCHAR2(5),
HA1 VARCHAR2(2),
HA2 VARCHAR2(2),
COFF DATE
Absent_hrs number(3));
insert into bhel (EMPNAME,PUNCH_DATE,SHIFT1,IN_PUNCH1,OUT_PUNCH1,SHIFT2,IN_PUNCH2,OUT_PUNCH2,ABS_HRS,SHORT_ABS,HA1,HA2values('&EMPNAME','&PUNCH_DATE','&SHIFT1','&IN_PUNCH1','&OUT_PUNCH1','&SHIFT2','&IN_PUNCH2','&OUT_PUNCH2','&ABS_HRS','&SHORT_ABS','&HA1','&HA2','&COFF');
Ganapathy,
Welcome to JavaRanch! That's an awful lot of code. Please repost with the minimum amount of code that shows your problem. Also, I didn't catch what error you are encountering. It may be there - the length of the post prevented me from spotting it.
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.