Current location: Hot Scripts Forums » Programming Languages » ASP » Problem Updating


Problem Updating

Reply
  #1 (permalink)  
Old 08-18-03, 01:18 AM
sasi sasi is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
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?...
Reply With Quote
  #2 (permalink)  
Old 08-18-03, 01:55 AM
MadDog MadDog is offline
Code Master
 
Join Date: Aug 2003
Posts: 935
Thanks: 0
Thanked 0 Times in 0 Posts
Try this:
Code:
<%
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

DO While not ss.EOF
	If ss.fields("class id")<>"" then
		DO while not ss1.EOF
			totalmark = totalmark + ss1("total")
		Loop
	End If
Loop

strSQL="UPDATE table1 SET full mark='" & totalmark & "' WHERE Name='" & request.form("txtname") & "';"
cnn.execute(strSQL)
%>
__________________
Drew Gauderman
ASP - MSSQL Coder / Buisness Owner / Coder for Hire!
MSN-ICQ-AIM-YIM in Profile

http://www.iportalx.net an easy ASP portal system.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
random link problem doogi PHP 18 03-04-09 01:00 AM
file download problem ukyankee Perl 6 10-04-03 10:39 PM
getting -2147217900 error while inserting and updating skchakri ASP 3 09-20-03 10:34 AM
jpGraph axis labeling problem Squeezer PHP 2 08-20-03 07:53 AM


All times are GMT -5. The time now is 03:17 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.