how to get field info from recorset?

pickle
04-20-2002, 01:36 PM
<%
dim strMsg

How do i the get staffID field from the recordset? It seems to return an error....

if Len(Request.Form("cmdLogin"))then
set conn = server.CreateObject ("adodb.connection")
conn.ConnectionString = strConn
conn.Open
Username = Request.Form ("txtUsername")
Password = Request.Form ("txtPassword")

if Username <> "" or Password <> "" then
set RS = conn.Execute ("SELECT * FROM Staff " & _
"WHERE StaffName = '" & Username & "'" & _
" and password = '" & Password & "'")

if RS.EOF then
strMsg = "Invalid Login"
else
Session("Username") = Request.Form ("txtUserName")
Session("StaffID") = RS!StaffID
Response.Cookies ("Username") = Request.Form ("txtuserName")
Response.Redirect "LoginRespond.asp"
end if
if strMsg <> "" then
Response.write strMsg
else
Response.Write "Please enter login"
end if
end if
end if

Derek Stone
04-20-2002, 05:34 PM
Session("StaffID") = RS.Fields.Item("StaffID").Value


Good Luck
-CL

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum