update one table column from another table column
hi
i have two table
StudentAccountTable and billmonthly
studentaccounttable contain
Student Id Namefield Class Roll BalanceAmount
1001 abc 2 3 2500.00
1002 Dbc 3 3 3500.00
here studentid is primary key
in billmonthly
StudentID Total amount
1001 100
1002 1500
Here StudentId Also Primary Key
now i wann update studentaccounttable (BalanceAmount) at once from Billmonthly (TotalAmount) for this i make query on sql
UPDATE StudentAccountTable
SET BalanceAmount = StudentAccountTable.BalanceAmount+billMonthly.Tota l
FROM StudentAccountTable, billMonthly
WHERE StudentAccountTable.StudentId = billMonthly.StudentId
which work very well
now i want this code work through code
Please help me to do this through code
Thanks in Advance
|