hello everyone,
I am stuck with this problem.If anyone could help me, it would be a great favour.
I am working on a leave application.
Here the leaves are been applied by employees and accordingly the leaves are been approved or cancelled.
so the problem is that when i am retrieving values such as from date and to date from another jsp i am using
[B]String[] leavefrom;
String[] until;
leavefrom=request.getParameterValues("leavefrom");
for(int counter=0; counter < leavefrom.length; counter++)
{
}
until=request.getParameterValues("until");
for(int counter=0; counter < until.length; counter++)
{
}[/B]
so that i get all the values of different employees.but when i am comparing it with the database values i am facing an error such as ,
only the dates which are from 12 to 30/31 .rest all the dates from 1 to 11 are not been updated in the database.i am just giving the code where the problem exists.I know how to do the connectivity and everything is working fine except for this one.
[B]ps=con.prepareStatement("update emp_leave_application set status='"+approved[counter]+"' where approver='"+username+"' and m_emp_no='"+userid[counter]+"' and leave_type='"+leavetype[counter]+"'and from_date=? and to_date=?");
ps.setString(1,leavefrom[counter]);
ps.setString(2,until[counter]);
ps.executeUpdate();[/B]
here i am using [B]ps.setString() [/B]
wherein, i have to use [B]ps.setDate()[/B]
instead to compare it with the database, but how to write it when i am using an array .It is giving me an error saying that cant convert string to date.
Pls help me
Thanks in advance.