Advanced ASP Programming (20): querying data records of ADO components

Source: Internet
Author: User
Tags zip
First, understand the principle.
1. Enter the text box to query the content.
2. Submit the query information to the page for processing.
3. The program page is mainly used to receive query information. Based on this information, a specific SQL query statement is called to obtain the query result and display it.
In fact, the main essence is the writing of SQL statements.
The previous extraction is "select * form whattable where id =" & id
Insert as "insert into whattable (xx_rs) values ('" & content &"')"
Delete as "delete from whattable where id =" & id
Change to "update whattable set xx_rs = '" & log_content & "'Where id =" & id
The query is "select * form whattable where xx_rs like '%" & wahtkey & "% '"
The following is an example to study
1. Create a zip table in the database zipcode. mdb.
Field id, type automatic number (keyword)
Field placename, type text
Field province, type text
Field zipcode, type text
Field borough, type text
2. Add database information content
Id, no need to add
City and City corresponding to placename
Province corresponding to province
Zip Code
Borough region ID
3. Connection file conn. asp
Db_path = "zipcode. mdb"
Set conn = Server. CreateObject ("ADODB. Connection ")
Connstr = "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & Server. MapPath (db_path)
Conn. Open connstr

4. search. asp
<Form action = "search. asp" method = "post">
<Input type = "text" name = "zipcode">
<Input type = "submit" name = "submit" value = "search">
[Ctrl + A Select All tips: You can modify some code and then press run]
5. Information query page, which is also search. asp
<! -- # Include file = "conn. asp" -->
If request. form ("submit") = "search" then
Whatzip = request. form ("zipcode ")
Set rs = Server. CreateObject ("ADODB. Recordset ")
SQL = "Select * from zip where zipcode like '%" & whatzip & "% '"
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.