View Single Post
  #1 (permalink)  
Old 06-11-2007, 06:20 AM
Heather Heather is offline
Senior Member
 
Join Date: Jun 2007
Posts: 164
Heather is on a distinguished road
calendar object in preparedStatement
I have an object and its attribute is calendar type, now I want to run a query in database, so I create a preparedStatement, in the data base there is a field who its type is date.

But this error appears in the red line:


cannot find symbol

in interface preparedStatement
method setDate(int, java.util.Calendar)

Code:
Calendar d = new GregorianCalendar(); d.set(2007,6,6); String insertEvent = "INSERT INTO EVENTS(DATE,TYPE,COMMENT) VALUES(?,?,?);"; ConnectionSingleton connection = ConnectionSingleton .getInstance(); PreparedStatement preparedInsert = connection.getConnection().prepareStatement(insertEvent); preparedInsert.setDate(1,ev.getDate().getTime()); preparedInsert.setString(2,ev.getType()); preparedInsert.setString(3,ev.getComment());
Reply With Quote
Sponsored Links