Hi, I am running the 1st script after a form has been submitted.
It will check if the input values are already in the database. If not, it will insert the data with a opo-up saying data are inserted. If no, it will have a pop-up which will ask for confirmation to overwrite the records in the database. if the user click no, it will go back to the original form with a pop up saying records not inserted. If yes, it will go to the 2nd script which will update the records in the database with a pop-up saying records inserted.
However, I am unable to parse the value from the 1st scrip to the 2nd script and also the 2nd script cannot seemed to work. Can anyone help?
Code:
<%
DIM insNAME, insYEAR, insRATING
insNAME = Request.Form("txtselName")
insYEAR = Request.Form("txtselYear")
insRATING = Request.Form("txtselRating")
sqlcheck="select * from subdb_subcon_rating WHERE NAME LIKE '"&insNAME&"' AND YEAR LIKE '"&insYEAR&"'"
Set check = OraDatabase.Execute(sqlcheck)
if check.EOF then
sql="INSERT into subdb_subcon_rating(NAME, YEAR, RATING) values ('"&insNAME&"','"&insYEAR&"','"&insRATING&"')"
Set objRS = OraDatabase.Execute(sql)
%>
<script language="VBScript">
MsgBox "Records have been inserted",64,"Alert"
window.location= "input_records.asp"
</script>
<%
else
%>
<form name="update_subcon_ratings_records" method="Get" action="this.form.submit()">
<input type=hidden name="frmNAME" value="insNAME">
<input type=hidden name="frmYEAR" value="insYEAR">
<input type=hidden name="frmRATING" value="insRATING">
</form>
<script language="VBScript">
returnvalue=MsgBox("Records already exist in Database!"& vbCrLf &"Do you want to overwrite the records?",36,"Alert")
if returnvalue=6 then
window.location="update_subcon_ratings_records.asp"
else
MsgBox "Records NOT inserted",16,"Alert"
history.go(-1)
end if
</script>
<%
end if
%>
It will check if the input values are already in the database. If not, it will insert the data with a opo-up saying data are inserted. If no, it will have a pop-up which will ask for confirmation to overwrite the records in the database. if the user click no, it will go back to the original form with a pop up saying records not inserted. If yes, it will go to the 2nd script which will update the records in the database with a pop-up saying records inserted.
However, I am unable to parse the value from the 1st scrip to the 2nd script and also the 2nd script cannot seemed to work. Can anyone help?
Code:
<%
DIM updNAME, updYEAR, updRATING
updNAME = Request.Form("frmNAME")
updYEAR = Request.Form("frmYEAR")
updRATING = Request.Form("frmRATING")
response.write("frmNAME")
OraDatabase.Execute("UPDATE subdb_subcon_rating SET RATING = '"&updRATING&"' WHERE NAME LIKE '"&updNAME&"' AND YEAR LIKE '"&updYEAR&"'")
%>
<script language="VBScript">
MsgBox ("Records have been inserted",64,"Alert")
window.location="input_records.asp"
</script>