Hi,
this is not a wicket question, but a java question.
However: why do you use String for a Date information?
Statement has setDate method and wicket has DateField and DateTextField.

Bye
Luca



Il 05/04/2012 07:27, SudeepShakya ha scritto:
I have two textboxes which take dates using datepicker(I have set Date.class
in the Textbox also) and a dropdown choice which takes 'telecom' and I have
getters and setters for all of them. I have set all of them as String. And
the query  and code for doing the operation for selecting the data is below
:

String query = "SELECT * FROM tbl_vote INNER JOIN tbl_contestant WHERE ( (
(tbl_vote.tokenID = tbl_contestant.tokenID) AND tbl_vote.telecom = ?)  AND
(date_time>= ? AND date_time<= ?))";

  PreparedStatement statement = this.db.prepareStatement(query);
           statement.setString(1, aVote.getTelecom());
            statement.setString(2,aVote.getDate1());
               statement.setString(3, aVote.getDate2());

The datepicker sets the date in format 4/5/12 (dd/mm/yy) but I know that
mySql use the format yyyy-mm-dd. So when i enter the dates and the other
field, the data is not retrieved.
So how to set date to the database ? I have set Date field as 'datetime' in
database.
Is there some wrong logic in my code/query ?

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Inserting-String-Date-problem-tp4534005p4534005.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to