1. Bitte erstellen Sie einen Datenbanknamen in SQLServer: House und führen Sie das folgende Skript im Haus aus
iFexists (select*fromSysObjectSwhereId = Object_id (n´ [dbo]. [City] ´) andObjectProperty (id, n´isussertable ') = 1)
Droptable [DBO]. [Stadt]
GEHEN
iFexists (select*fromSysObjectSwhereId = Object_id (n´ [dbo]. [Bereich] ´) andObjectProperty (id, n´isusertable ') = 1)
Droptable [DBO]. [Bereich]
GEHEN
CreatEtable [DBO]. [Stadt] (
[ID] [int] Identität (1,1) Notnull,
[Name] [Nvarchar] (10) NULL
) Auf [primär]
GEHEN
Createtable [dbo]. [Bereich] (
[ID] [int] Identität (1,1) Notnull,
[Cityid] [int] null,
[Name] [Nvarchar] (20) NULL
) Auf [primär]
GEHEN
InsertIntoCity (ID, Name) Werte (1, "Guangzhou")
InsertIntoCity (ID, Name) Werte (2, "Shanghai")
InsertIntoCity (ID, Name) Werte (3, "Peking"))
InsertIntoarea (ID, Cityid, Name) Werte (1,1, "Tianhe")
InsertIntoarea (ID, Cityid, Name) Werte (2,1, "weiße Cloud")
InsertIntoArea (ID, Cityid, Name) Werte (3,2, "Hongkou")
InsertIntoarea (ID, Cityid, Name) Werte (4,2, "Baoshan")
InsertIntoarea (ID, Cityid, Name) Werte (5,2, "Jing'an").
InsertIntoarea (ID, Cityid, Name) Werte (6,3, "Haidian")
InsertIntoarea (ID, Cityid, Name) Werte (7,3, "Chaoyang")
2. Erstellen Sie eine Datei
Erstellen Sie Datei CityData.asp
<%@Sprache = vbScript%>
<%RsDispatch%>
<ScripTrunat = serverLanguage = javaScript>
<!-#includevirtual = "/_ scriptLibrary/rs.asp"->
<!-#includevirtual = "/jsconn.asp"->
functionDescription ()
{
this.getAeaaSArray = degetdata;
}
public_description = newDescription ();
FunctionDogetData (Cityid)
{
varsql, rst, strtext, conn, i, j
conn = newActActXObject ("adodb.Connection");
Conn.ConnectionString = ConnStr;
Conn.ConnectionTimeout = 30;