• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with inserting data in a same column using prepared statement

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
i am having a problem in inserting the data into database,i have 2 insert 4 rows into a column n every thing the last row overwrites the rest n only the last row is displayed in the database
the code is blow,plz help me slove this problem...
the opt1,opt2,opt3 are over written by opt4 n only opt4 is there is the database
thanks in advance...
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is nothing abnormal happening here I believe.
You are making only one insert and hence one row is getting inserted.
Only opt4 is getting inserted only because of this line :
pstat1.setString(2,opt4);
Replace opt4 with opt3, then only a row with opt3 will appear.
Make 4 inserts (instead of one) in order to insert 4 rows.
You may also go for a batch insert.
[ March 16, 2004: Message edited by: Varun Khanna ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic