Execute Update from Java to Access database problem...

Discussion in 'Java' started by lalalala, May 26, 2006.

  1. lalalala

    lalalala Guest

    public boolean addItem(String barcode, String style, String colour,
    String size, String qty, String store){
    boolean complete = false;
    String addItem = "INSERT INTO items (barcode, style, colour, size,
    qty, store) VALUES
    ('"+barcode+"','"+style+"','"+colour+"','"+size+"','"+qty+"','"+store+"')";
    Statement stmnt = null;
    System.out.println(addItem);
    try {
    stmnt = conn01.createStatement();
    stmnt.executeUpdate(addItem);
    //stmnt.execute(addItem);
    complete = true;
    } catch (SQLException e) {
    e.printStackTrace();
    }

    return complete;
    }

    -----The statement works but the executeUpdate isnt updating the
    database, when i use the same query directly in access it works and the
    connection works for other queries, that modify the information of an
    already existant row of information, but for this im not getting any
    errors its just not updating my database.
    Any ideas on what it could be?
    Any help would be greatly appreciated.
    Thank you, and ignore last message i fixed that problem
     
    lalalala, May 26, 2006
    #1
    1. Advertising

  2. lalalala

    ducnbyu Guest

    Do you need a commit?
     
    ducnbyu, May 26, 2006
    #2
    1. Advertising

  3. lalalala

    lalalala Guest

    Well for previous update statements it wasnt required (SQL commit), and
    they updated succesfully. Although perhaps it is because in this case
    i'm trying to insert a new row in the table.
     
    lalalala, May 26, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. joun
    Replies:
    9
    Views:
    2,284
    W.G. Ryan eMVP
    Nov 30, 2004
  2. joun
    Replies:
    5
    Views:
    2,709
  3. JC
    Replies:
    3
    Views:
    613
    =?ISO-8859-2?Q?Dra=BEen_Gemi=E6?=
    Jun 19, 2006
  4. PeterKellner
    Replies:
    1
    Views:
    209
    mou piya
    Jun 2, 2006
  5. Savas Ates
    Replies:
    1
    Views:
    308
    Patrice
    Aug 17, 2004
Loading...

Share This Page