Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Putting VBscript value in ASP

Status
Not open for further replies.

omoo

Programmer
May 30, 2005
87
US
Hi, I posted this in another thread but realise the title shd change so I posted this problem with another title:

The "returnvalue" in the VBscript could not be parsed to the ASP if-else statement. Anyone can help?

Code:
<%
DIM NAME, YEAR, RATING, returnvalue

NAME = Request.Form("NAME")
YEAR = Request.Form("YEAR")
RATING = Request.Form("RATING")

sqlcheck="select * from subdb_subcon_rating WHERE NAME LIKE '"&NAME&"' AND YEAR LIKE '"&YEAR&"'"
Set check = OraDatabase.Execute(sqlcheck)

if check.EOF then

	sql="INSERT into subdb_subcon_rating(NAME, YEAR, RATING) values ('"&NAME&"','"&YEAR&"','"&RATING&"')"
	Set objRS = OraDatabase.Execute(sql)	
%>
	<script language="VBScript">	
	MsgBox "Records have been inserted",64,"Alert"
	window.location= "input_records.asp"
	</script>
<%
else
%>
	<script language="VBScript">	
	returnvalue=MsgBox ("Records already exist in Database!"& vbCrLf &"Do you want to overwrite the records?",36,"Alert")
	</script>
	
<%	
	if returnvalue=6 Then

OraDatabase.Execute("UPDATE subdb_subcon_rating SET RATING = '"&RATING&"' WHERE NAME LIKE '"&NAME&"' AND YEAR LIKE '"&YEAR&"'")%>
				
		<script language="VBScript">
		MsgBox "Records have been inserted",64,"Alert"
		window.location="input_records.asp"
		</script>
	
<%		
	else
%>	
		
		<script language="VBScript">
		MsgBox "Records NOT inserted",16,"Alert"
		history.go(-1)
		</script>
		
<%
	end if

end if
 
VBScript executes client side while ASP on server side.

Therefore returnValue will NEVER be accessible to ASP that way.

You will have to resubmit back the page (after storing the value in a hidden field) and request for the hidden field in ASP.

Another option is XmlHttp of javascript...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top