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

 1   
 2  
 3  
 4  
 5rem x=0 表示不存在,x=1 表示存在   
 6  
 7strConn=\"DBQ=\"+server.mappath(\"zw.mdb\")+\";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};\"   
 8set objConn=server.createobject(\"Adodb.connection\")   
 9objConn.open strConn   
10set rsSchema=objConn.openSchema(20)   
11rsSchema.movefirst   
12  
13tablename=\"gd111\"   
14x=0   
15Do Until rsSchema.EOF   
16if rsSchema(\"TABLE_TYPE\")=\"TABLE\" then   
17  
18if rsSchema(\"TABLE_NAME\")=tablename then   
19x=1   
20exit do   
21end if   
22end if   
23  
24  
25rsSchema.movenext   
26Loop   
27  
28if x=0 then response.write\"没有找到!!!\"   
29  
30if x=1 then response.write\"找到了\"   
31  
32  
33set objConn=nothing   
Published At
Categories with Web编程
Tagged with
comments powered by Disqus