OpenSchema方法技术探讨(二)

类别:软件工程 点击:0 评论:0 推荐:

利用openschema可以获得所有表的主键,当然这只是它的很多功能中的一个。

connstr = "Provider=MSDAORA.1;User ID=liujincai;password=ljc1001;Data Source=hp1"
set mm=server.CreateObject("adodb.connection")
mm.Open connstr
Const adSchemaPrimaryKeys = 28
set rs=mm.OpenSchema(adSchemaPrimaryKeys)
Response.Write "<table>"
Response.Write "<TR>"

for i=0 to rs.fields.count-1
Response.Write "<td>" & rs(i).name & "</td>"
next
Response.Write "</tr> "
do while not rs.eof
Response.Write "<tr>"
for i=0 to rs.fields.count-1
Response.Write "<td>" & rs(i) & "</td>"
next
Response.Write "</tr> "
rs.movenext
loop
Response.write “</table>“

'下面的语句获得表'TB_HOUSE_MAIN'的主键所在的字段
rs.Filter="TABLE_NAME='TB_HOUSE_MAIN'"
if not(rs.eof  and rs.bof) then Response.Write rs("COLUMN_NAME")

本文地址:http://com.8s8s.com/it/it36085.htm