1. SQLServer에서 데이터베이스 이름을 작성하십시오 : 집에서 다음 스크립트를 실행하십시오.
ifexists (select*fromsysobjectswhereid = object_id (n´ [dbo].
DROPTABLE [DBO]. [City]
가다
ifexists (select*fromsysobjectswhereid = object_id (n´ [dbo]. [area] ´) andobjectproperty (id, n´isusertable ') = 1)
드롭 테이블 [DBO]. [영역]
가다
Createtable [dbo]. [City] (
[id] [int] Identity (1,1) Notnull,
[이름] [Nvarchar] (10) NULL
)에서 [1 차]
가다
CreateTable [DBO]. [Area] (
[id] [int] Identity (1,1) Notnull,
[CityId] [int] null,
[이름] [Nvarchar] (20) NULL
)에서 [1 차]
가다
insertIntocity (id, name) 값 (1, "Guangzhou")
insertIntocity (id, name) 값 (2, "상하이")
insertIntocity (id, name) 값 (3, "베이징")
insertIntoarea (id, cityid, name) 값 (1,1, "tianhe")
insertIntoarea (id, cityid, name) 값 (2,1, "화이트 클라우드")
InsertIntoarea (ID, CityID, 이름) 값 (3,2, "Hongkou")
InsertIntoarea (ID, CityID, 이름) 값 (4,2, "Baoshan")
insertIntoarea (id, cityid, name) 값 (5,2, "Jing'an")
insertIntoarea (id, cityid, name) 값 (6,3, "Haidian")
InsertIntoarea (ID, CityID, 이름) 값 (7,3, "Chaoyang")
2. 파일을 만듭니다
파일 CityData.asp를 만듭니다
<%@language = vbscript%>
<%rsdispatch%>
<scriptrunat = serverLanguage = javaScript>
<!-#includevirtual = "/_ scriptLibrary/rs.asp"->
<!-#includevirtual = "/jsconn.asp"->
functionDescription ()
{
this.getAreaasarray = dogetData;
}
public_description = newDescription ();
FunctionDogetData (CityId)
{
varsql, rst, strtext, conn, i, j
conn = newActivexObject ( "adodb.connection");
conn.connectionstring = connstr;
conn.connectiontimeout = 30;