Solved

checking database

Posted on 2004-04-09
3
269 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Having Returning  Anonymous Function Access Global Function 7 112
Create associate webpages / websites 3 101
website content maintenance 3 111
API Soap Calls 4 138
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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 dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

756 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