Hi all,

Can somebody pls tell me how I can insert a Date type into a database table
with a Date datatype?

I have the year, month, and day as interger values.  I need to convert these
values into an sql Date object so I can now insert the Date object into the
table, right?

I have the folllowing code:
Calendar cbirthday = null;
java.util.sql birthday = null;
.
.
.
cbirthday = Calendar.getInstance();
cbirthday.set(Integer.parseInt(year), Integer.parseInt(month),
Integer.parseInt(day));
birthday = cbirthday.getTime();

This last statement throws a cast exception!  Even when I chnage it to:
birthday = (java.sql.Date) cbirthday.getTime();

Pls tell me what I'm doing wrongly.

Emma


To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to