ASP Query Records

Source: Internet
Author: User

ASP Query records:

Learning Purpose: Learn the basic operation of database--query record

On the fourth day we use one of the following programs:

We're looking at all the records, but we're not going to be able to get all the records when we want to modify or delete the records, all of us have to learn to retrieve the right records. First look at a statement:

A= "AAA"

b=1111110

Exec= "SELECT * from guestbook where name= '" +a+ "' and Tel= ' +b

Where the following is the condition, with and, or, I think everyone knows the meaning of =,<=,>=,<,>. The search name is "AAA" and the phone is a record of "1111110". The other thing is if you're searching for a field that contains a string, you can write this: where InStr (Name,a) is the person who searches for the string of a (AAA) in name.

My a,b here, is a constant, you can let A,b is the form submitted to the variable, so you can do a search.

Let's take a look at this code and understand this: (Save the following code as a 6.htm file)

Search:

Name =

and tel=

Exam6.asp (Save the following code as exam6.asp)

<%

Do as not rs.eof

%>

  

  

  

  

  

<%

Rs.movenext

Loop

%>

  

<%=rs ("name")%> <%=rs ("tel")%> <%=rs ("message")%> <%=rs ("Time")%>

First enter http://localhost/6.htm in the browser as shown in the following image:

Enter the name and phone aaa,1111110 that are already in the database, and click Submit, as shown in the following figure:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.