Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

checking database

Posted on 2004-04-09
3
Medium Priority
?
280 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
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 440 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

927 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