日期:2014-05-17 浏览次数:20829 次
<% sTable = "view_xxx" Response.Write isViewExists(sTable) Function isViewExists(sTable) On Error Resume Next Dim conn, sConn, oCat, colTables, oTable sConn = "Provider=SQLOLEDB;Data source=127.0.0.1;Initial Catalog=db;User ID=sa;Password=xxx;" Set conn = CreateObject("ADODB.Connection") conn.Open sConn Set oCat = CreateObject("ADOX.Catalog") Set oCat.ActiveConnection = conn Set colTables = oCat.Tables Set oTable = colTables(sTable) If oTable Is Nothing Then isViewExists = False Else isViewExists = True End If Set oTable = Nothing Set colTables = Nothing Set oCat = Nothing conn.Close Set conn = Nothing End Function %>