1. يرجى إنشاء اسم قاعدة بيانات في SQLServer: منزل وتشغيل البرنامج النصي التالي في المنزل
ifexists (SELECT*fromSysObjectSwhereId = Object_id (n´ [dbo].
القابض [DBO]. [المدينة]
يذهب
ifexists (SELECT*fromSysObjectSwhereId = object_id (n´ [dbo].
القابض [DBO]. [المنطقة]
يذهب
CreateTable [DBO]. [City] (
[id] [int] الهوية (1،1) Notnull ،
[الاسم] [nvarchar] (10) NULL
) على [الابتدائية]
يذهب
CreateTable [DBO]. [المنطقة] (
[id] [int] الهوية (1،1) Notnull ،
[cityid] [int] null ،
[الاسم] [nvarchar] (20) NULL
) على [الابتدائية]
يذهب
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 ، "White Cloud")
insertintoarea (id ، cityid ، name) القيم (3،2 ، "Hongkou")
insertintoarea (id ، cityid ، name) القيم (4،2 ، "Baoshan")
insertintoarea (id ، cityid ، name) القيم (5،2 ، "Jing'an")
insertintoarea (id ، cityid ، name) القيم (6،3 ، "Haidian")
insertintoarea (id ، cityid ، name) القيم (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 () ؛
وظيفة dogetdata (CityId)
{
varsql ، rst ، strtext ، conn ، i ، j
conn = newactivexObject ("adodb.connection") ؛
conn.ConnectionString = connstr ؛
conn.ConnectionTimeout = 30 ؛