当前位置:首页
开发技术指南» 文章正文
    引言:

 ·我……    »显示摘要«
    摘要: 喝一口啤酒,阿德说:你是个怪物。 我皱着眉头看着他:难道知道严凤英也算怪物? “要知道,严凤英去世的时候。我们父母都还是小学生。” “只不过我比较喜欢一些老的东西,听听她唱的黄梅戏,真的非常悦耳好听。” 阿德又喝了口酒说:“靠,现在的年轻人,有几个知道黄梅戏的,听过就不错,还知道天仙配是严凤英唱红的,那就是怪物了。” “…… 我还知道马兰演过严凤英的片子……我还很喜欢我们山东的吕剧,真的很......
    摘要: 如题,谢谢 ......


大家研究:连接数据库时能不能把表的名称也显示出来

如:  
          表table1    
                字段1,字段2,字段3,...  
          表table2    
                字段1,字段2,字段3,...  
   
  能不能读出表table1,表table2呀  
   
  大家研究一下!!!!!

NO.1   作者: ecwy

察看sql数据库结构方法1  
   
  <%on   error   resume   next  
  Set   cn   =   Server.CreateObject("ADODB.Connection")  
  cn.Open   "driver={SQL   Server};server=*.*.*.*;database=**;uid=**;pwd=**"  
   
  Sql1="select   *   from   dbo.sysobjects   where   type   not   in(S,D,K)"  
  Sql1="select   *   from   dbo.sysobjects   where   type   =U"  
  set   rscc   =   server.createobject("ADODB.recordset")  
  set   rs   =   server.createobject("ADODB.recordset")  
  rscc.open   sql1,cn,1,3  
   
   
      do     while   not   rscc.eof  
   
   
        sql   ="select     *   from   "&RSCC("name")  
         
        rs.open   sql,cn,1,2    
      response.write   "<hr>表名"&RSCC("name")&"<br>"  
  if   "1"="1"   then  
      for   i=0   to   rs.Fields.Count-1  
   
      response.write   "字段名:"&rs.fields(i).name   &"<br>"  
      response.write   "类型:"  
      if   rs.fields(i).type="3"   then  
          response.write   "int"  
          if   rs.fields(i).Attributes="16"   then   response.write   "     自动编号字段"  
          if   rs.fields(i).Attributes="120"   then   response.write   "     允许空"  
          if   rs.fields(i).Attributes="24"   then   response.write   "     不允许空"  
      elseif   rs.fields(i).type="129"   then  
          response.write   "char"  
          response.write   "大小"&rs.fields(i).DefinedSize    
          if   rs.fields(i).Attributes="120"   then   response.write   "     允许空"  
          if   rs.fields(i).Attributes="24"   then   response.write   "     不允许空"  
      elseif   rs.fields(i).type="201"   then  
              response.write   "text"  
              if   rs.fields(i).Attributes="234"   then   response.write   "     允许空"  
              if   rs.fields(i).Attributes="138"   then   response.write   "     不允许空"  
      elseif   rs.fields(i).type="202"   then  
              response.write   "nvarchar"  
              response.write   "大小"&rs.fields(i).DefinedSize    
              if   rs.fields(i).Attributes="8"   then   response.write   "     !           不允许空"  
              if   rs.fields(i).Attributes="104"   then   response.write   "!           允许空"  
      elseif   rs.fields(i).type="131"   then  
              response.write   "numeric"  
              if   rs.fields(i).Attributes="120"   then   response.write   "     允许空"  
              if   rs.fields(i).Attributes="24"   then   response.write   "     不允许空"  
      elseif   rs.fields(i).type="2"   then  
              response.write   "smallint"  
              if   rs.fields(i).Attributes="120"   then   response.write   "!           允许空"  
              if   rs.fields(i).Attributes="24"   then   response.write   "     !           不允许空"  
      elseif   rs.fields(i).type="11"   then  
            response.write   "bit"  
            if   rs.fields(i).Attributes="120"   then   response.write   "!           允许空"  
            if   rs.fields(i).Attributes="24"   then   response.write   "     !           不允许空"  
      elseif   rs.fields(i).type="135"   then  
            response.write   "smalldatetime"  
            if   rs.fields(i).Attributes="120"   then   response.write   "!           允许空"  
            if   rs.fields(i).Attributes="24"   then   response.write   "     !           不允许空"  
      elseif   rs.fields(i).type="203"   then  
            response.write   "ntext"  
            if   rs.fields(i).Attributes="234"   then   response.write   "!           允许空"  
            if   rs.fields(i).Attributes="138"   then   response.write   "     !           不允许空"  
      elseif   rs.fields(i).type="6"   then  
            response.write   "money"  
            if   rs.fields(i).Attributes="120"   then   response.write   "!           允许空"  
            if   rs.fields(i).Attributes="24"   then   response.write   "     !           不允许空"  
      elseif   rs.fields(i).type="130"   then  
            response.write   "nchar"  
            if   rs.fields(i).Attributes="120"   then   response.write   "!           允许空"  
            if   rs.fields(i).Attributes="24"   then   response.write   "     !           不允许空"  
      elseif   rs.fields(i).type="4"   then  
            response.write   "real"  
          if   rs.fields(i).Attributes="120"   then   response.write   "!           允许空"  
          if   rs.fields(i).Attributes="24"   then   response.write   "     !           不允许空"  
      elseif   rs.fields(i).type="5"   then  
          response.write   "flat"  
          if   rs.fields(i).Attributes="120"   then   response.write   "!           允许空"  
          if   rs.fields(i).Attributes="24"   then   response.write   "     !           不允许空"  
      elseif   rs.fields(i).type="128"   then  
          response.write   "binary"  
          if   rs.fields(i).Attributes="120"   then   response.write   "!           允许空"  
          if   rs.fields(i).Attributes="24"   then   response.write   "     !           不允许空"  
      else  
          response.write   "未知"&rs.fields(i).type  
      end   if  
   
      response.write   "           属性:"&rs.fields(i).Attributes  
      response.write   "-------------<br>"  
   
      next  
  end   if  
  rs.close  
   
  -------------------------------------  
        rscc.MoveNext  
  loop  
  set   rs=nothing  
  set   rscc=nothing  
   
  set   conn=nothing  
  %>    
 

NO.2   作者: madpolice

<%  
  connstr="provider=sqloledb;data   source=127.0.0.1;user   id=sa;password=sa;initial   catalog=test"  
  connstr="provider=microsoft.jet.oledb.4.0;data   source="   &   server.mappath("db.mdb")  
  set   conn=server.createobject("adodb.connection")  
  conn.open   connstr  
   
  set   ad=server.createobject("adox.catalog")  
  ad.activeconnection=conn  
  for   each   tb   in   ad.tables  
  response.write   tb.name   &   "<br>"  
  next  
  set   ad=nothing  
   
  conn.close  
  set   conn=nothing  
  %>  
 

NO.3   作者: tigerwen01

用:   select   *   from   sysobjects   where   xtype=U   and   status>0   就可以列出数据库中所有的用户建立的表名。  
 

NO.4   作者: itzhiren

不管什么数据库,都有存放各个表的信息的一个表


 ·求一正则表达式    »显示摘要«
    摘要: 有一字符串 $content = <div id="memberflat" class="titlebar"> <div class="drawsidetow">会员平台</div> <div class="smalltitle">为何注册?</div&......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE