Recommended: asp write record aspWrite records: Learning purpose: Learn the basic operations of the database--The basic operations of writing records database are nothing more than: query records, write records, delete records, and modify records. Today we will learn to write records first. First create a form: (Save the following article as 5.htm) form name=form1 method=post action=exa5.asp name input type=text
Asp query record:
Learning purpose: Learn the basic operations of database--query records
On the fourth day we used the following program:
We are querying all records, but when we want to modify and delete records, we cannot be all records. We need to learn to retrieve appropriate records. Let's look at a sentence first:
a=aaa
b=11111110
exec=select * from guestbook where name='+a+'and tel=+b
Where is added with the condition, and is and or or, I think everyone knows the meaning of =, <=,>=, <,>. The meaning of this sentence is to search for a record with name aaa and the phone number is 1111110. Another point is that if you want to search for whether a field contains a string, you can write it like this: where instr(name, a) is the search for the person with the string a(aaa) in name.
My a, b, are constants. You can make a and b the variables submitted by the form, so that you can do a search.
Let’s take a look at this code below and understand it: (Save the following code as a 6.htm file)
search:
name =
and tel=
exam6.asp (Save the following code as exam6.asp)
<%
do while not rs.eof
%>
<%
rs.movenext
loop
%>
First, enter http://localhost/6.htm in the browser as shown in the figure below:
Enter the existing name and phone number aaaa, 11111110, click Submit, the result is shown in the figure below:
Share: Common codes used in ASP programming Common codes for ASP programming -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------