Hello
I am a beginner ASP programmer, and I am programming a login form as follows:
<form name="frontform" method=POST action="<table align="center" >
<tr><td valign=top>
<label>CostCentre</label></td><td valign=middle><input name="Userniame"><br><br></td>
</tr>
</table>
</fieldset><br>
<button name="pjtbtn" type=button>Submit</button>
</form>
I have a VBscript routine as follows:
<script language=vbscript>
sub pjtbtn_onclick
if len(trim(document.frontform.Userniame.value))=0 then
msgbox "Please enter username"
exit sub
end if
msgbox cstr("<%=strconnect%>")
<%
lstrSQL="Select username, pwd from Login where username = '" + document.frontform.Userniame.value + "'"
objRec.Open lstrSQL,objConn,adOpenDynamic
if not objRec.EOF then
objRec.movefirst
end if
%>
msgbox "cstr(<%=objREC.fields("pwd")%>)"
document.frontform.submit()
end sub
</script>
What I am trying to do is obtain a username from the form, look it up in a recordset objRec (previously opened and connected successfully) in the VBscript routine, and msgbox the corresponding password.
However the browser doesn't seem to like the ASP code in the VBscript routine. Am I allowed to use ASP script in this routine???? "strconnect" refers to the connection string earlier in the page, and that msgboxes OK. It's just the bit referring to the recordset in the VBscript routine that it doesn't like.
I would really appreciate code snippets on how to manipulate the recordset in the VBscript routine!
Many thanks,
Trimtrom
I am a beginner ASP programmer, and I am programming a login form as follows:
<form name="frontform" method=POST action="<table align="center" >
<tr><td valign=top>
<label>CostCentre</label></td><td valign=middle><input name="Userniame"><br><br></td>
</tr>
</table>
</fieldset><br>
<button name="pjtbtn" type=button>Submit</button>
</form>
I have a VBscript routine as follows:
<script language=vbscript>
sub pjtbtn_onclick
if len(trim(document.frontform.Userniame.value))=0 then
msgbox "Please enter username"
exit sub
end if
msgbox cstr("<%=strconnect%>")
<%
lstrSQL="Select username, pwd from Login where username = '" + document.frontform.Userniame.value + "'"
objRec.Open lstrSQL,objConn,adOpenDynamic
if not objRec.EOF then
objRec.movefirst
end if
%>
msgbox "cstr(<%=objREC.fields("pwd")%>)"
document.frontform.submit()
end sub
</script>
What I am trying to do is obtain a username from the form, look it up in a recordset objRec (previously opened and connected successfully) in the VBscript routine, and msgbox the corresponding password.
However the browser doesn't seem to like the ASP code in the VBscript routine. Am I allowed to use ASP script in this routine???? "strconnect" refers to the connection string earlier in the page, and that msgboxes OK. It's just the bit referring to the recordset in the VBscript routine that it doesn't like.
I would really appreciate code snippets on how to manipulate the recordset in the VBscript routine!
Many thanks,
Trimtrom