Cannot get data into a recordset of an asp page

I am using MS SQL server with InterDev as an editor coding in html and asp.  I have a web-based application
which resides in a subdirectory of another web-based application.

So the directory looks like this:

RecognizeYourBestPerformers      folder
    RecognizeYourBestCustomers    folder

As you can see, the "RecognizeYourBestCustomers" web-based application is in  a subdirectory of "RecognizeYourBestPerformers".

The "RecognizeYourBestPerformers" web-based app works fine.
Theses applications uses a .udl for the path.  The .uld is suppose to have all of the path information inside of it to get to the
right server.

The "RecognizeYourBestPerformers" app points to the .uld.  The "RecognizeYourBestCustomers" app also points to the same .udl.

Here is some of my code:
<HTML>
<TITLE>Recognize Your Best Customers Log-in Screen </TITLE>

<BODY>

<FORM name=frmInput method="get" action="process.asp">
 
<TABLE>
        <TR>
                <TD align=right>User Name:</TD>
                <TD align=left>
                        <INPUT style="WIDTH: 100px" class=inptext name="txtUserName" id="txtUserName" type="text" > 
                </TD>
        </TR>
        <TR>
                <TD align=right >Password:</TD>
                <TD align=left ><INPUT style="WIDTH: 100px" class=inptext maxlength=6 id="txtPassWord" name="txtPassWord" type="password" ></TD>
        </TR>
</TABLE>

<TABLE width=40%>
        <TR>
                <TD align=center>
                        <INPUT class=button type=submit value=" Log-in " >
                </TD>
        </TR>
</TABLE>
</FORM>
</HTML>

The system is suppose to go to the "process.asp" page and verify passwords.  See the "Form" tag statement.  The system does go
to the "process.asp" page, but I cannot get data from the server about the user's name role and password.

I have the following code in the process.asp page.

dim strConn
strConn = "Recognize.udl"
       
        dim str_SQL, obj, rs
        dim strSID
        dim strUserName
        dim strPassWord
               
        strSID = session.SessionID
        strUserName = Request.Form("txtUserName")
        strPassWord = Request.Form("txtPassWord")
       
        str_SQL = "select * from tbls_users where (user_name = '" & strUserName & "') " & _
                                "and (role_password = '" & strPassWord & "')"
        set obj=Server.CreateObject("SQLInstructions.SQL")
       
''Note:  I use a SQLInstructions.SQL file to create a Server Object.  I then use this object to execute the SQL statement
'to the server.  

        set rs = obj.execute(str_SQL,strConn)
       
       
        if not rs.eof then  'If there are any records in the users table with a user name and password then proceed.
               
                'Set session variables
                session("strSessionID") = strSID
                session("strUserName")= strUserName
                session("strJudge")=rs("Judge")
                session.Timeout = 60
               
                if rs("judge") = "fulltime" or rs("judge")="parttime" then
                        Response.Redirect "ProgramAdmin.asp"
                else
                        Response.Redirect "LoginScreen.asp"
                end if
               
        else 'If there are no records that match the user name and password then go back to the LoginScreen.
                Response.Redirect "LoginScreen.asp"
    end if
   
    rs.close
%>
 

PROBLEM: I cannot get data from the recordset to determine if the user should be directed to the next page or be redirected
back to the same page.  I tried "response.write rs("Judge")".  That does not work.

Any comments from anyone as to why data in not being populated into the recordset of the "process.asp" page.  The first web-based
application works fine.  Is it possible that subdirectories why have something to do with it?


Thanks
The Firebird
BirdsOfFire1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

raj3060Commented:
Try to use:
Response.Write(rs("Judge"))

Keep more write statements to debug the problem.

**If you get page not found error then it could be directory problem. My guess is that you are not getting recordset. Best way to figure out is keep some srite statements and figure out where you have the problem.
0
raj3060Commented:
Another thing I noticed: Use this instead
Response.Redirect("ProgramAdmin.asp")
Response.Redirect ("LoginScreen.asp")
0
BirdsOfFire1Author Commented:
To:  raj3060

This statement does not work in the process.asp page:

alert ("This is a test")

I will try this:

Response.Write(rs("Judge"))


Thanks
The Firebird


0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

eyeh8uCommented:
Personaly, I use ADODB to connect, I find it much easier to work with.

str_SQL = "select * from tbls_users where (user_name = '" & strUserName & "') " & _
                                "and (role_password = '" & strPassWord & "')"

Set obj = Server.CreateObject("ADODB.Connection")
obj.Connect Application("ConnectionString")
Set comm = Server.CreateObject("ADODB.Command")
Comm.ActiveConnection = obj
Set RS = Server.CreateObject("ADODB.Recordset")

Comm.CommandText = str_SQL

RS.Open Comm

If Not RS.EOF Then
...

You define a connection string typicaly in a global.asa file in the application_onstart event as follows:

Application("ConnectionString") = "your oledb init string from your .udl file"

Since both of your applications point to the same .udl, then you can probably use one global.asa with one connection string.
0
BirdsOfFire1Author Commented:
To:  eyeh8u

Below is the connection string that is in the .udl:

"provider=sqloledb;server=dbMainServer;initial catalog=Sales;trusted_connection=yes"

1.  Would you place this connect string information in your code to give me an idea of the syntax.

2.  Also, should I define "Comm"?:
     Dim  comm


Thanks
The Firebird
0
eyeh8uCommented:
Global.asa goes in the docroot of your web site. If you have a virtual directory, it will need it's own copy of global.asa in it's docroot.

Database.asp and closedatabase.asp go in the root of your web server. The command:

<!--#include virtual="/database.asp"-->

Will include it in your page scope, you'd have this in every page that did database operations to provide you with an open, connected database object, a command object and a recordset object to do your database operations with.

Any page that includes it should include closedatabase.asp to clean up your objects. You should always DIM every variable you use, and use Option Explicit to make ASP REQUIRE a variable to be declared prior to use (which prevents you ever having errors like:

<%
Dim mynumber
mynumber = 1
mynumber = mynubmer + 1
Response.Write mynumber ' prints 1, when you might have wanted 2...
%>

Option Explicit will cause ASP to throw an error on the sumation line of "Variable not declared mynubmer".

--- global.asa ----
<script language="VBScript" runat="Server">
sub application_onstart()
  ' application wide setting for database location:
  application("connectionstring") = "provider=sqloledb;server=dbMainServer;initial catalog=Sales;trusted_connection=yes"
end sub
</script>
--- end global.asa ---

--- database.asp ---
<%
' Define ADODB Objects:
Dim objConn, objComm, objRS
' Create ADODB Objects
Set objConn = Server.CreateObject("ADODB.Connection")
Set objComm = Server.CreateObject("ADODB.Command")
Set objRS = Server.CreateObject("ADODB.Recordset")

' Open a connection, and assign it to the command object
objConn.Open Application("ConnectionString")
objComm.ActiveConnection = objConn
%>
--- end database.asp ---

--- closedatabase.asp ---
<%
Set objRS = Nothing
Set objComm = Nothing
Set objConn = Nothing
%>
-- closedatabase.asp ---

--- somefile.asp ---
<%@ LANGUAGE=VBScript%>
<%
Option Explicit
%>
<!--#include virtual="/database.asp"-->
<%
dim str_SQLdim strSID
dim strUserName
dim strPassWord
               
strSID = session.SessionID
strUserName = Request.Form("txtUserName")
strPassWord = Request.Form("txtPassWord")

str_SQL =  "select * from tbls_users where (user_name = '" & strUserName & "') " & _
                                "and (role_password = '" & strPassWord & "')"

objComm.CommandText = str_SQL
objRS.Open Comm

if Not objRS.EOF Then
...
Else
...
End If

objRS.Close
%>
<!--#include virtual="/closedatabase.asp"-->
--- end somefile.asp ---
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.