Can anyone see why I keep geting an error in the strSql=/rs.open area that says that it cannot do the operation because the recordset is closed? I am trying to test when the user chooses a menu item if the user has records in that area. If they don't then I want them to stay out until they do. Thanks... Bandit
Here is my code:
// By Bandit 2/28/2004
<!--#include file="include/dbconnection.asp"-->
<%
' filter user
username=Session("User")
' open database connection
Set rs = server.CreateObject ("ADODB.Recordset")
set dbConnection = server.CreateObject ("ADODB.Connection")
dbConnection.ConnectionString = strConnection
dbConnection.Open
' set SQL statement
strSQL = "Select Count(*) From Locations where MR= ' & username & ' "
rs.Open strSQL
' execute SQL statement
dbConnection.Execute strSQL
' run test
if rs.EOF then
%>
<script>
alert('No locations have been assigned to you. Please contact the office.');
</script>
<%
else
response.redirect "locations_list.asp"
end if
' close recordset and database connection
rs.close
dbConnection.close
%>
// End Bandit's Code