正 文

判断一个access数据库中某个表是否存在的方法


www.7dspace.com  更新日期:2005-8-17 3:02:27  七度空间


  ASP程序如下:

<%

rem x=0 表示不存在,x=1 表示存在

strConn="DBQ="+server.mappath("zw.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set objConn=server.createobject("Adodb.connection")
objConn.open strConn
set rsSchema=objConn.openSchema(20)
rsSchema.movefirst

tablename="gd111"
x=0
Do Until rsSchema.EOF
   if rsSchema("TABLE_TYPE")="TABLE" then

    if  rsSchema("TABLE_NAME")=tablename then
        x=1
        exit do
    end if
   end if


   rsSchema.movenext
Loop

if x=0 then response.write"没有找到!!!"

if x=1 then response.write"找到了"


set objConn=nothing
%>


上一篇:关于SQL server中字段值为null的查询
下一篇:SQL Server发邮件配置
作者:  来源:七度空间整理 ( 责任编辑:7dspace )
收藏此页】【打印】【关闭
站 内 搜 索
 

热 点 导 读
特 别 推 荐