Hi I am trying to do an insert query but for some reason although there
appears to be no exception thrown my data does not get into the database.
I will try to explain what I am doing
In SQL you can do the following sort of statement
INSERT INTO mytable (fname, lname, age) VALUES ('Joe', 'Bloggs', 20);
I realise this is not a java newsgroup but please forgive my use of java
specific syntax below.
I am trying to replicate this in Java by doing this
String query = "INSERT INTO mytable (fname, lname, age) VALUES ";
query = query + " ('" + method call that returns a string + "', '"
query = query + method call that returns a string + "', "
query = query + method call that returns an int + ");"
executeUpdate(query);
as far as I am concerned this should equate to the same thing as I wrote in
the first instance, but when I inspect the contents of the literal query it
appears as
INSERT INTO mytable (fname, lname, age) VALUES (\'Joe\', \'Bloggs\', 20);
^^^^^^^^^^^^^^^
Inserts backslashes
Is this why my Update is not working and if so what do I need to do.
Thanks in advance,
Eamon.