asp得到库所有表 ,asp得到表字段属性。
程序代码:
call DataName("admin",0,0)'0 为conn , 1 为 conn_zhaopin '有重复红色显示 xianshi_f:0 所有,1 为红色 ''''''''''''''''''''''''''''''''表存在与否查询及有判断''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' function DataName(biaoming_f,kuming_f,xianshi_f) '0 为conn , 1 为 conn_zhaopin '有重复红色显示 xianshi_f:0 所有,1 为红色 if int(kuming_f) = 0 then set rsSchema_f = conn.openSchema(20) elseif int(kuming_f) = 1 then set rsSchema_f = conn_zhaopin.openSchema(20) end if rsSchema_f.movefirst Do Until rsSchema_f.EOF if rsSchema_f("TABLE_TYPE")="TABLE" then if instr(rsSchema_f("TABLE_NAME"),biaoming_f) > 0 then response.write "<font color='#ff0000'>"&rsSchema_f("TABLE_NAME") & "</font><br>" if int(xianshi_f) = 1 then exit do end if else response.write rsSchema_f("TABLE_NAME") & "<br>" end if end if rsSchema_f.movenext Loop rsSchema_f.close end function 'function DataName() ''''''''''''''''''''''''''''''''字段查询及是否有判断'''''''''''''''''''''''''''''''''''''''''''开始'''''''''''''''''''' response.write DataNameCong("admin_biandong","yuanzhanghao",1) '0 为 conn , 1 为 conn_zhaopin 检查表中是否含字段或查询字段属性值 Function DataNameCong(biao_f,ziduan_f,shujuku_f)'0 为 conn , 1 为 conn_zhaopin youzhege_f = 0 shuchule_f = "" xSql = "Select * From "&biao_f&"" Set xRs = Server.CreateObject("ADODB.RecordSet") if int(shujuku_f) = 0 then xRs.Open xSql,conn,1,1 elseif int(shujuku_f) = 1 then xRs.Open xSql,conn_zhaopin,1,1 end if For I = 0 To xRs.Fields.Count - 1 'if cstr(xRs(i).Name) = cstr(ziduan_f) then if instr(xRs(i).Name,ziduan_f) > 0 then ' response.write 11 'response.end youzhege_f = 1 shuchule_f = "<br>表:"&biao_f&" 中已有字段:"&ziduan_f&"--"&xRs(i).type&"--" exit for end if Next xRs.close Set xRs = nothing if int(youzhege_f) = 1 then Set objColumnRS = Conn.OpenSchema(4,Array(Empty, Empty, biao_f)) do while not objColumnRS.EOF ' response.write shuchule_f 'response.end if instr(objColumnRS("Column_Name"),ziduan_f) > 0 then shuchule_f = shuchule_f&"---默认值:"&objColumnRS("Column_Default") exit do 'objColumnRS("Column_Default") 'objColumnRS("Column_Name") '返回字段名 end if objColumnRS.MoveNext Loop Set objColumnRS = Nothing end if 'DataNameCong = "<br>表:"&biao_f&" 无 该字段 "&ziduan_f&"" DataNameCong = shuchule_f ' DataNameCong = 11 'response.write 11 'response.end End Function 'Function DataNameC(biao_f,ziduan_f)