DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2006
    Posts
    3

    Java + MS Access

    I'm trying to insert dates from a JTextField onto an Acess database. It refuses to enter the date correctly , it either goes in as some garbage like "1.234756425" or "1993"

    Can anyone help please? its driving me insane

  2. #2
    Join Date
    Mar 2006
    Posts
    3
    The code is something like this

    connection code here



    Calendar cal = Calendar.getInstance();
    Date today = cal.getTime();
    SimpleDateFormat fmt =new SimpleDateFormat("MM-dd-yyyy");
    String todayStr = fmt.format(today);

    executequery("insert into table values("+todayStr+","+othervalue+")";

  3. #3
    Join Date
    Dec 2004
    Posts
    61
    Well, if you already have debug your code then if the todayStr is holded the value that you wanted (a string value with a date format) than are you sure that the data type of your Access database field is also a date data type (ex: your field name is fldTodayDate and the data type is DateTime) ?

Similar Threads

  1. Java and MS Access database
    By borceivanovski in forum Database
    Replies: 0
    Last Post: 04-26-2005, 05:35 PM
  2. Access database creation from Java
    By Binu in forum Java
    Replies: 0
    Last Post: 05-16-2002, 09:54 AM
  3. General class in java to access database using JDBC
    By Rafat balaom in forum VB Classic
    Replies: 0
    Last Post: 12-09-2001, 02:47 AM
  4. Java access
    By Mike in forum Java
    Replies: 1
    Last Post: 04-20-2001, 11:29 AM
  5. java applet connection to access
    By Jorge in forum Java
    Replies: 1
    Last Post: 01-03-2001, 07:39 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links