Solved

checking database

Posted on 2004-04-09
3
272 Views
Last Modified: 2007-12-19
Hey guys

ok i am trying to check a value entered by the user if it exists in the access database or not can you please tell me what is wrong with this code. Because when the user clicks sumit it does nothing.
i mean if it finds a match it should redirect the page to "service.asp" otherwise if it does not find the match it should display a error message.

thanks



dim conn, rs, sql
dim client_phone_number

set conn=Server.CreateObject("ADODB.Connection")
conn.open "int213db"

sql = "select * FROM abcTel where client_phone_number='" &request.form("number")&"'"

set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,adopenstatic



      if rs.recordcount=0 then
            response.write "there are no matches found"
      else
            response.redirect "service.asp"
end if



rs.close
set rs = nothing
conn.close
set conn = nothing
0
Comment
Question by:punjabijatt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Expert Comment

by:venkateshwarr
ID: 10795929
Enable internet explorer friendly errors and see if it is giving out any errors.
0
 
LVL 1

Accepted Solution

by:
rminnich earned 110 total points
ID: 10795949
First, does adopenstatic have a value?  I had to include the type library for ADO to recognize the constant.
Is this line in your ASP file?
<!- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common Files\system\ado\msado15.dll" -->
0
 

Author Comment

by:punjabijatt
ID: 10796633
yes it has the include file. here is the code.  










<html>
            <title>
                  Assignment 1
                        </title>
      <body bgcolor=#000066 textcolor="white">

            <h2><font color="blue">Int213 Assignment 2
            <h2><font color="blue">Group Member 1: Gaurav Sood</font></h2>
            <h2><font color="blue">Group Member 2: Samir Budhdeo</font></h2>
            <h2><font color="blue">Student# 035-774-033</font></h2>
            <h2><font color="blue">Email Address: gsood1@learn.senecac.on.ca</font></h2>
            <h2><font color="blue">Instructor: Ling Zhu</font></h2><br>

            <form action="login.asp" method="post" action="">

                  Account# <input type="text" name="number" size=12><font color="red" SIZE="-1"> Format: xxx-xxxxxxx</FONT><BR>
                  Pin#<input type="password" name="pin" size=12><br><br>
                  <INPUT TYPE="submit" NAME="submit" VALUE="Login">

            </form>

<%
            acc = request.form("number")
            pass = request.form("pin")


            
      
            

            If request.form("submit")="Login" then
                  if len(acc)= 0 or len(pass) = 0 then
                        response.write "Error 1 : Please enter a valid user name or password."
                  elseif pass <> "99" then
                        response.write "Error 2 : Password does not match."      
                  elseif len(acc) <> 11 then            
                        response.write "Erro 3 : The length should be 11."
                  elseif mid(acc,4,1) <> "-" then
                        response.write "Error 4 : The character on the forth position must be a (-)"
                  else
                  
      
                  
                  

dim conn, rs, sql
dim client_phone_number

set conn=Server.CreateObject("ADODB.Connection")
conn.open "int213db"

sql = "select * FROM abcTel where client_phone_number='" & acc &"'"

set rs=server.createobject("ADODB.Recordset")
rs.open sql,conn,adopenstatic



      if rs.recordcount=0 then
            response.write "there are no matches found"
      else
            response.redirect "service.asp"
end if



rs.close
set rs = nothing
conn.close
set conn = nothing

end if
end if




%>
</body>
</html>



0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question