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!

Retrieving value from a variable / Request.Form

Status
Not open for further replies.

2122002

IS-IT--Management
Apr 22, 2003
58
US
I have a Form called "StaffList.asp" and another one is call "Entitlement.asp".

Stafflist.asp have this input value (as password field).

<TD ALIGN=CENTER><INPUT TYPE=PASSWORD NAME="Enrolment">


Entitlement.asp supposed to carry out SQL search based on the input value from "enrolment" field;



Below SQL statement does not work
==================================
rsView.Open "Select * From [Staff_Module] WHERE StaffEnrolNr= '"&Enrolment&"'", DB
==================================

However, the SQL statement runs Only if I quote StaffEnrolment number, for example "DJ1122", as in below:

====================================
rsView.Open "Select * From [Staff_Module] WHERE StaffEnrolNr= 'DJ1122'", DB
====================================



Here is the original code.....

<%
Dim DB, rsView , sql, Enrolment

Enrolment = Request.form("Enrolment")

'Enrolment = Request("Enrolment")

set DB=Server.CreateObject("ADODB.Connection")
set rsView=Server.CreateObject("ADODB.Recordset")
DB.Open "Personnel"
rsView.Open "Select * From [StaffEnrolList] WHERE StaffEnrolNr= '"&Enrolment&"'", DB

%>

Dan
 
i dont see anything wrong with the code...can you show your remaining form page...
also response.write your sql statement to see if the variable Enrolment is getting populated correctly from the form correctly...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top