| Author |
creating multiple rows
|
pankaj semwal
Ranch Hand
Joined: Oct 07, 2008
Posts: 300
|
|
Hi,
Below is my code which creating multiples row.But i want only to create single row.
Can any body tell me where i am wrong .and how to solve this.
Thanks
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
You are running you insert statement in a loop.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Leonardo Carreira
Ranch Hand
Joined: Apr 07, 2009
Posts: 482
|
|
Sir..
is looping insert statements good for implementation?..
any suggestion?...
Thanks in advance...
|
Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26496
|
|
Leonardo Carreira wrote:is looping insert statements good for implementation?..
any suggestion?...
It's not the looping is bad if you want multiple rows. (Although using a batch insert would be better.)
Paul meant that your SQL inserts one row per filename. Since you expressed an interest in only having one row overall, he commented the loop would do more than that.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
pankaj semwal
Ranch Hand
Joined: Oct 07, 2008
Posts: 300
|
|
Then how to solve this problem.
Please tell me.
Thanks
|
 |
Vijitha Kumara
Bartender
Joined: Mar 24, 2008
Posts: 3673
|
|
pankaj semwal wrote:Then how to solve this problem.
What exactly you want to insert (in terms of number of records) apart from what Jeanne & Paul suggested? It depends on your requirement.
|
SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
So your "uploadFileNames" is an array of four strings, and you want those four strings to be the last four of the five columns you will insert into one row? Then don't use a loop:
|
 |
rk palleru
Greenhorn
Joined: Feb 26, 2009
Posts: 22
|
|
|
Paul Clapham said correct answer.
|
 |
 |
|
|
subject: creating multiple rows
|
|
|