Page 2 of 2 FirstFirst 12
Results 21 to 24 of 24
Like Tree1Likes

Thread: SQL problems

  1. #21
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL problems

    Quote Originally Posted by JosAH View Post
    According to your code:

    Java Code:
       updateMthd("INSERT INTO Extra" + "VALUES(naam1, naam2, playup, rotate)");
    Your database receives the String "INSERT INTO ExtraVALUES(naam1, naam2, playup, rotate)" Note the lack of a space between "Extra" and "VALUES" ...

    kind regards,

    Jos
    The code now looks like this:
    Java Code:
    private String naam1;
          private String naam2;
          private String playup;
          private String rotate;
       
           SQLUserinfo (String nm1, String nm2, String plyp, String rtte)throws SQLException
          {
             naam1 = nm1;
             naam2 = nm2;
             playup = plyp;
             rotate = rtte;
             updateMthd("INSERT INTO Extra VALUES(naam1, naam2, playup, rotate)");
          }

  2. #22
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,437
    Blog Entries
    7
    Rep Power
    20

    Default Re: SQL problems

    Quote Originally Posted by Johanis View Post
    The code now looks like this:
    Java Code:
    private String naam1;
          private String naam2;
          private String playup;
          private String rotate;
       
           SQLUserinfo (String nm1, String nm2, String plyp, String rtte)throws SQLException
          {
             naam1 = nm1;
             naam2 = nm2;
             playup = plyp;
             rotate = rtte;
             updateMthd("INSERT INTO Extra VALUES(naam1, naam2, playup, rotate)");
          }
    I don't think so: I can see single quotes around those values in one of your other posts; I also see your SQL engine complaining about 4 parameters; I suspect that in your real code you're using single back quotes somewhere ... Print out the actual String you're sending to your SQL engine and check it carefully.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #23
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL problems

    Do you mean single quotes around the values next to VALUES? I changed them.

  4. #24
    Johanis is offline Senior Member
    Join Date
    Oct 2010
    Posts
    139
    Rep Power
    0

    Default Re: SQL problems

    I now put in a System.out in and it gets the Strings from the other class.
    Java Code:
     SQLUserinfo (String nm1, String nm2, String plyp, String rtte)throws SQLException
          {
             naam1 = nm1;
             naam2 = nm2;
             playup = plyp;
             rotate = rtte;
             System.out.println(naam1+naam2+playup+rotate);
             updateMthd("INSERT INTO Extra VALUES(naam1, naam2, playup, rotate)");
          }

Page 2 of 2 FirstFirst 12

Similar Threads

  1. need help with several problems
    By tidus1103 in forum New To Java
    Replies: 4
    Last Post: 03-11-2011, 01:10 AM
  2. InputStream/Jar Problems/File IO Problems
    By rdjava in forum Advanced Java
    Replies: 31
    Last Post: 01-17-2011, 11:12 AM
  3. Problems here
    By Keno777 in forum New To Java
    Replies: 2
    Last Post: 11-13-2009, 11:35 AM
  4. JAR problems
    By Evil Smurf in forum New To Java
    Replies: 4
    Last Post: 09-01-2009, 01:17 AM
  5. many to many problems
    By cecily in forum JDBC
    Replies: 1
    Last Post: 08-02-2007, 05:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •