Subject | Re: [Firebird-Java] Re: Select statement with Date |
---|---|
Author | Luca Lafranchi |
Post date | 2004-06-08T07:02:02Z |
Hi Paul!
PreparedStatement pstmt = connection.prepareStatement(
"Select EmpName, EmpID from EMP where logoutdate=?");
pstmt.setDate(1,today);
ResultSet rs = pstmt.executeQuery();
This should work.
Ciao
Luca
>Use PreparedStatements:
> I am using
>
> GregorianCalendar todayCal = new GregorianCalendar();
> java.sql.Date today = new java.sql.Date(todayCal.getTimeInMillis());
>
> "Select EmpName, EmpID from EMP where logoutdate='"+today+"';
PreparedStatement pstmt = connection.prepareStatement(
"Select EmpName, EmpID from EMP where logoutdate=?");
pstmt.setDate(1,today);
ResultSet rs = pstmt.executeQuery();
This should work.
Ciao
Luca