一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

ASP做查询分析器(Query Analyzer)(II)

时间:2008-01-18 编辑:简简单单 来源:一聚教程网

sqlultimate.asp--Part B
'     ++++++++++++++     FK Sub    +++++++++++++++++
SUB FK(xdbname, xuserid, xpassword )
Dim strConn,conntemp,rsSchema,PKT,PKC,FKT,FKC
Const adSchemaForeignKeys = 27
strConn =    "Provider=SQLOLEDB.1;Data Source="&strServer&";" & _
       "Initial Catalog=" & xdbname & _
       ";UID=" & xuserid & ";PWD=" & xpassword & ";"
        set conntemp = server.createobject("adodb.connection")
        response.write("

" & vbCrLf)
        response.write("" & vbCrLf)
        response.write("" & vbCrLf)
        conntemp.open strConn
        set rsSchema = conntemp.OpenSchema(adSchemaForeignKeys)
    DO UNTIL rsSchema.eof
        PKT = rsSchema.fields("PK_TABLE_NAME")
       PKC = rsSchema.fields("PK_COLUMN_NAME")
       FKT = rsSchema.fields("FK_TABLE_NAME")
Primary KeyForeign Key
PK TablePK FieldFK TableFK Field