Use ASP nested JS + SQL Server to create two levels of linking boxes (1)

zhaozj2021-02-16  51

Use ASP nested JS SQL Server to create two levels of linking frame (1)

With the rapid development of network technology, more and more e-commerce websites also come to life. And in building a powerful e-commerce website often provides online registration function to register this module itself, in order to fill in the information as much as possible, we often use the drop-down box for customer selection, especially two-level linkage. Most common.

Bes, I found that I found 9CBS forum today, I have regularly ask this question, that is, I need a two-level link to pull the box, the first display the name of the province, the second display corresponding city name. In order to understand this question, I have specially write this article, I hope to help users who need this information.

First, let's design the database first (SQL Server 7.0)

● Database name: DB_PROVINCAT

● Table name: 1) TB_PROVINCE 2) TB_CITY

Description: Table TB_Province is used to store the provincial name; Table TB_CITY is used to store the corresponding city name.

● Field name design

1) Table TB_Province's field has a provincial ID number (province code), province name (provincename), Table 1 shows:

ProvincialCatid Provincecode Provincename

1 01 Beijing

2 02 Shanghai

3 03 Tianjin City

4 04 Chongqing City

5 05 Guangdong Province

6 06 Zhejiang Province

7 07 Fujian Province

8 08 Hainan Province

9 09 Jiangsu Province

Table 1

2) Table TB_CITY field has a city ID (CityID), citycode, city name, Table 2 shows an example:

CityId Citycode CityName

1 01001 Beijing

2 02001 Shanghai

3 03001 Tianjin City

4 04001 Chongqing City

5 05001 Guangzhou

6 05002 Shenzhen City

7 05003 Zhuhai City

8 05004 Maoming City

9 05005 Zhongshan City

10 06001 Hangzhou

11 06002 Wenzhou City

12 07001 Fuzhou City

13 07002 Xiamen City

14 08001 Haikou City

15 08002 Sanya City

16 08003 Wanning City

17 08004 Five Guishan City

18 09001 Nanjing

19 09002 Suzhou City

Table 2

Description: One thing to note here is that the identity code should correspond to the heads of the city code.

Second, write code. Here is a complete source code:

(Endlessly)

转载请注明原文地址:https://www.9cbs.com/read-23257.html

New Post(0)