|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
problem updating
i have 2 table's...
table 1-Name,adresss,full mark,class id table 2-Name,subjek,mark1,mark2,total now i have to calculate the total marks for the student...for all subject tat the student takes... my coding goes like this: <% strsql="Select class id from table 1 where Name=request.form("txtname");" strsql1="Select total from table 2 where Name=request.form("txtname");" set ss=cnn.execute(strsql) set ss1=cnn.execute(strsql1) %> <% dim totalmark totalmark=0 while not ss.eof %> <% if ss.fields(class id)<>"" then while not ss1.eof totalmark=totalmark+ss1.fields(total) wend strsql2="update table1 SET full mark='"&totalmark&"' WHERE Name=request.form("txtname") %> ..the problem is this coding doesnt work...where am i wrong?... |
|
#2
|
|||
|
|||
|
you can do this all in SQL, just do
Code:
SELECT SUM(total) FROM table then you have your sum, yeah, update your other db as needed. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > problem updating |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|