updating another table's column with presnt gridview's total

Posted by Jammyhunt under ASP.NET on 8/3/2013 | Points: 10 | Views : 941 | Status : [Member] | Replies : 3
Greets everybody



i have a salary table like this

table1(gridview)

sl.no name salary

1 raj 1000

2 aman 1200

3 khan 900

4 jammy 1100

total 4200



and i have another table like this

table2
sl.no name total salary

1 total 0



how to update table2's column total salary with total of table 1




Responses

Posted by: Jitendrasoft09 on: 8/3/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Jammyhunt,

I will suggest you to try first as following.

Create a stored procedure

Get total salary with sum function from Table1 and assign to variable.

Use update command to set total of Table1 into Table2.

Hope you are clear.





Jitendra Kumar
If my post helps you, plz mark as an answer.

Jammyhunt, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jammyhunt on: 8/4/2013 [Member] Starter | Points: 25

Up
0
Down
why cant i store total from row databound event to the table2 using update command

Jammyhunt, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jitendrasoft09 on: 8/4/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Jammyhunt,

You are exactly right. You can do with row databound event. When you are taking the value like sl.no from gridview and matching to that sl.no to the table to update. This requirement you can keep inside stored procedure with parameters means passing arguments as sl.no to re use this same any where to transact with two tables.

Jitendra Kumar
If my post helps you, plz mark as an answer.

Jammyhunt, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response