判断ACCESS数据库中是否已经存在相同的表与字段

<%

Function Access_IsTable(Table_Name)
 Set Rs=Conn.openSchema(20)
 Rs.MoveFirst
 
 Dim IsTable
 
 IsTable=False
 
 Do Until Rs.Eof
  If Rs("TABLE_TYPE")="TABLE" Then
   If LCase(Rs("TABLE_NAME"))=LCase(Table_Name) Then
    IsTable=True
    Exit Do
   End If
  End If
  
  Rs.MoveNext
 Loop
 CloseRs(Rs)
 
 Access_IsTable=IsTable
End Function

 

Function Access_IsField(Table_Name,Field_Name)
 Dim IsField,Rs,i
 
 IsField=False
 
 Set Rs=OpenRs("Select * From "&Table_Name)
 If Rs.Fields.Count>0 Then
  For i=0 to Rs.Fields.Count-1
   If Rs.Fields(i).Name=Field_Name Then
    IsField=True
   End If
  Next
 End If
 CloseRs(Rs)
 
 Access_IsField=IsField
End Function

%>

你可能感兴趣的:(字段,表,ACCESS数据库)