我想知道db.mdb中是否存在client表

解决方案 »

  1.   

    Dim cn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim strCn As StringSet cn = New ADODB.Connection
    strCn = "driver={SQL Server};server=srv;uid=sa;pwd=;database=pubs"cn.Open strCnSet rs = cn.OpenSchema(adSchemaTables) Do Until rs.EOF  if rs!TABLE_NAME ="client" then 
         msgbox""
         exit
      else
        rs.MoveNext 
      endif
     Looprs.Close
    cn.Close
      

  2.   

    rst.Open "select * from dbo.sysobjects where id = object_id(N'[dbo].[tblKeyVerification]') and OBJECTPROPERTY(id, N'IsUserTable') = 1", cnn
            If rst.BOF And rst.EOF Then
                MsgBox "table myTable not existed"
            Else
                MsgBox "table myTable existed"
            End If
            rst.Close
      

  3.   

    DimVar() 高
     dao 和ado一样的道理
      

  4.   

    set rst=db.openrecordset("select * from dbo.sysobjects where id = object_id(N'[dbo].[tblKeyVerification]') and OBJECTPROPERTY(id, N'IsUserTable') = 1") 
    If rst.BOF And rst.EOF Then
        MsgBox "table not exists"
    Else
        MsgBox "table exists"
    End If
      

  5.   

    dim tb as TableDef,yn as Boolean
    db.TableDefs.Refresh
    for each tb in db.TableDefs
       if lcase(tb.name)="client" then
          yn=true
        else
          yn=false
       endif
    next