4 messages in com.mysql.lists.javaRe: insert's| From | Sent On | Attachments |
|---|---|---|
| Arun Jamwal | 02 Feb 2000 17:03 | |
| Jeremy B. Friedman | 02 Feb 2000 18:33 | |
| LEBLANC, CLAUDE | 03 Feb 2000 16:24 | |
| Tilmann Singer | 03 Feb 2000 16:31 |
| Subject: | Re: insert's![]() |
|---|---|
| From: | LEBLANC, CLAUDE (clau...@bell.ca) |
| Date: | 02/03/2000 04:24:40 PM |
| List: | com.mysql.lists.java |
You forgot the field list ! and I don't use quotes for numeric values :
insert into myTABLE (myfield1, myfield2, myfieldA, myfieldB) values ("string1","string2", 1, 2)
note : not all fields have to be specified:
insert into myTABLE (myfield1) values ("string1")
trick : first try the statement right in mySQL to find the syntax that works then copy the same statement in your program.
Claude
"Jeremy B. Friedman" wrote:
I am trying to insert some values into a mysql table that are inputted from the previous servlet page. When I try and insert just text, it works fine, but how do I input variables into the table?
This works:
Stmt.executeUpdate("insert into TABLE
values(\"field1\",\"field2\",\"NULL\",\"20000202\")");
This doesn't:
Stmt.executeUpdate("insert into TABLE values(\" + ptitle + \",\" + particle +
\",\"NULL\",\"20000202\")");
What is the proper syntax for inputting variables into a table? Thanks in advance.
-------------------------------------------------------------------- Jeremy Friedman Computer Science Major jere...@udel.edu Yearbook Webmaster http://copland.udel.edu/~jeremyf http://www.yearbook.udel.edu
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.
--
------------------------------------------------------------------- Claude Leblanc Ingénierie du logiciel Bell Canada 1050 Beaver Hall, 2e étage tel: (514) 786-6438 Montréal, Quebec fax: (514) 870-2431 Canada H2Z 1S4 email: clau...@bell.ca
-------------------------------------------------------------------




