File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setNull(1, java.sql.Types.DATE)

 
Kee Kee moon
Ranch Hand
Posts: 147
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I use setNull(1, java.sql.Types.DATE); function, it will insert null on my table's column.
I want to select the date from another table and insert into my table's column, what should I do?
I am sure I cannot call setNull(1,java.sql.Types.DATE), it will insert NULL in my column.

Thanks in advance.
 
Jan Cumps
Bartender
Posts: 2577
11
C++ Linux Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use setDate() or setTimestamp().
 
Kee Kee moon
Ranch Hand
Posts: 147
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jan Cumps wrote:You can use setDate() or setTimestamp().


Would you please give me some examples how to use setDate or setTimestamp(). I have been working on setDate() but failed.
I got errors.
Thanks.

Sorry for the double post on the Java General forum.
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't describe how you failed. It would definitely help if you provided some explanation.

However I will take a guess: you don't understand that the setDate() method requires a java.sql.Date object and not a java.util.Date object, and you don't know how to get one of those. You said you were getting a date from some other table? Then the getDate() method returns you a java.sql.Date object which you can use.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic