• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can control mutiple updates

 
gunjan bohra
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I am working on ERP application .
I got 10 row into one jsp page.
Suppose I update one column value.When I want to save this I update
all 10 rows .means UPDATE SQL runs for all 10 rows
I don't want this ...I want which ever row I have update Only that
row Update will fire ...
How can I control this ...Is there any tool in market which can
track this information ..
Thanks
Gunjan Bohra
 
Reza Rav.
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your code logic have problem, just see your code
 
gunjan bohra
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I collect all rows in collection and update/Insert according to row flag .
Suppose In JSP 3 rows displayed now i changed 1 row 1 st field value .
So for all three rows I go fo update .Because I never know how can I control ......means which rows which field user on jsp update the value .....
So Is there standard solution for that .........
 
Sri Ram
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again ur Logic is the problem here.
When u get the rows u already have the primary key for that row in ur collection. All u have to do is set the primary key in the table as a row Attribute. On selecting a particular row, pass the primary key to the sql. Then do the Update for that particular key.
 
gunjan bohra
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From my logic I can easily understand that which row I want update and which row I want Insert....
But the problem is for each and every row either Insert or Update query fire....I want to protect this....
I want that only that rows should be update for which user enter some value or change come value
 
JuanP barbancho
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I understand that you need only change the row, have changed.

I think that you use JSP and you could use a litle of javascript, too?

You could send to the server a new HTML form field, that have a number or similar (String etc). This new field could be X (String) or bit active (number) when you need update the row.

This is a litle complex logic in Javascript client, but you minimize the number of update's.

Thansk you
 
gunjan bohra
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks ...
But is there any Standard tools ...so that any one can plug it and use it ...
any standard ....
now I am using JavaScript....
but we have to think over it ....
Thanks for your reply
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic