| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 494 人关注过本帖
标题:asp得到库所有表 ,asp得到表字段属性。
只看楼主 加入收藏
ysf0181
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:55
帖 子:914
专家分:2385
注 册:2006-10-4
结帖率:76.71%
收藏
 问题点数:0 回复次数:1 
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)
搜索更多相关主题的帖子: asp 
2012-06-13 15:20
ysf0181
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:55
帖 子:914
专家分:2385
注 册:2006-10-4
收藏
得分:0 
测试通过,希望对大家有用。

ASP讨论QQ群:251346273
2012-06-13 15:21
快速回复:asp得到库所有表 ,asp得到表字段属性。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.054097 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved