Query Analysis 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 ("<p align=center><table width=" "75%" ">" & vbCrLf)
Response.Write ("<tr bgcolor=black align=center><td colspan=2><font color=white><b>Primary KEY</B></FONT></TD><TD Colspan=2><font color=white><b>foreign Key</b> </font></td></tr> "& VbCrLf)
Response.Write ("<tr bgcolor=white align=center><td><b>pk table</b></td><td> <B>PK FIELD</B></TD><TD><B>FK TABLE</B></TD><TD><B>FK Field </b></td></tr> "& 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")
FKC = Rsschema.fields ("Fk_column_name")
If PKT <> "" Then
Response.Write ("<tr align=right><td bgcolor= #c6e9f4 >" &pkt & "</td><td>" & PKC & Amp "</td><td bgcolor= #c6e9f4 > & fkt&" </td><td> "& FKC &" </td></tr> "& VbCrLf)
End If
Rsschema.movenext
LOOP
Response.Write ("</table></p>" & VbCrLf)
Rsschema.close
Set rsschema=nothing
Conntemp.close
Set conntemp=nothing
End SUB
' ++++++++++++++ tabledropdown Sub +++++++++++++++++
Sub Tabledropdown (Xdbname, Xuserid, Xpassword)
Dim cnn, Cat, TBL
Dim connectstring
On Error Resume Next
ConnectString = _
"Provider=SQLOLEDB.1;Data source=" &strServer& ";" & _
"Initial catalog=" & Xdbname & _
"; Uid= "& Xuserid &"; Pwd= "& Xpassword &";
Set cnn = Server.CreateObject ("Adodb.connection")
Set cat = Server.CreateObject ("Adox.catalog")
Set tbl = Server.CreateObject ("adox.table")
Cnn. Open connectstring
If err.description <> "" Then
Response.Write ("<b>login please </b>" & vbCrLf)
End If
Cat. ActiveConnection = CNN
Response.Write ("<select name=" "strTableName" ">" & vbCrLf)
For each tbl in cat. Tables
If tbl. Typ