Statement statement = connection.createStatement();
			
	
            String frmdate = request.getParameter("date1");  
			String todate = request.getParameter("date2");  

			SimpleDateFormat df = new SimpleDateFormat("DD/MM/YYYY");	
			//Date frmdate = df.parse("strdate1"); 
            //Date todate = df.parse("strdate2");
			try {
    // java.util.Date date3 = df.parse(frmdate);
	// java.util.Date date4 = df.parse(todate);

     java.util.Date ufdate1 = df.parse(frmdate);
	 java.util.Date utdate2 = df.parse(todate);
	 java.sql.Date fs1 = new java.sql.Date(ufdate1.getTime());
	 java.sql.Date ts2 = new java.sql.Date(utdate2.getTime());
    // java.sql.Date sqlDate1 = new java.sql.Date(date3.getTime());
	// java.sql.Date sqlDate2 = new java.sql.Date(date4.getTime());
   } catch(ParseException e) {
        
   }
     PreparedStatement p =connection.prepareStatement("select g.iduser as \" UserId \", b.btid as \" BTID \", E.idaccount as \"ACCOUNT \"  ,F.acctdesc as \"ACC_NAME \", " +
"a.btfilerefno as \"FILEREFNO \", COUNT(A.btamount) as \"COUNT \", sum(a.btamount) as\" AMOUNT \", b.status as\" STATUS \","  + 
"(select count(BTTOKEN1) from btfilerecmap where btfilerefno = a.BTFILEREFNO and BTTOKEN1 = '7') as \" RTGS\", " +
"(select count(BTTOKEN1) from btfilerecmap where btfilerefno = a.BTFILEREFNO and BTTOKEN1 = '8') as \" NEFT \" from btfilerecmap a, btfileinfo b, BTACCTMAP E, " +
" MSTACCOUNT F,mstuser g , admintxnunauthdata h " +
" where a.btfilerefno = b.filerefno and g.iduser = b.iduser and a.btfilerefno = h.keycolumn2" +
" AND B.btid=E.btid and E.idaccount=F.idaccount and " +
" trunc(b.datupload) between to_date('?','DD/MM/YYYY') and to_date('?','DD/MM/YYYY ')" +
" and b.status='COMPLETE' and h.token4 = 'F' " +
" group by btfilerefno, status,b.btid, g.iduser, e.idaccount,f.acctdesc order by b.btid ");

//p.setDate(1,fs1);
//p.setDate(2,ts2);

p.setDate(1, new java.sql.Date(fs1.getTime()));
p.setDate(2, new java.sql.Date(ts2.getTime()));
            ResultSet resultset = p.executeQuery();

***********

getting error while retrving value reqyest urgent help..please..

ERROR  C:\Blazix\jspdir\corporate_jsp.java:174: cannot find symbol
symbol  : variable fs1
location: class desisoft_jsp_corporate_jsp1273297131154
p.setDate(1,fs1);
            ^
C:\Blazix\jspdir\corporate_jsp.java:175: cannot find symbol
symbol  : variable ts2
location: class desisoft_jsp_corporate_jsp1273297131154
p.setDate(2,ts2);

UnformattedCodeError at line -1, program terminated
SyntaxError at line -1, program terminated
NoCodeTagsError at line 1, program terminated
OutOfCheeseError at line 0, redo from start

commented: words. +9

i am not able to collect you .please now the solution

Don't write that kind of code in jsp. Use separate methods and call them from servlets.
Also learn sql because even if you manage to fix the errors the query is wrong.

Also the errors are pretty clear they tell exactly what the error is. And since you are dealing with jsp, means that you should be good and experience enough to correct those errors.

It says it cannot find the 'fs1', because it cannot see it from where you have declared it.

Also how on earth are you executing a query outside a try-catch?

i am just converting strings into date and fatch that value to sql query.

please tell me corret query with modified date criteria

The fs1, ts2 can not be "seen" at the lines that you get the errors, because they are out of scope. Because of where you have declared them

please guide me where it need to decalre as iam new to jsp

please guide me where it need to decalre as iam new to jsp

This has nothing to do with jsp. It is all basic core java. Which I assume that you already know. When I see this kind of jsp code the only advise I can give is to go back and read some tutorials and practice.

Because I already told you the solution. A solution that should have been understood since you think you are ready for jsps.

As Mr Migagi said: "First learn stand and then fly". And you want to go to the moon

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.