Listing C



Function fnTableExists(sFilePath, sTableName)

 Dim bRetVal, oDB

 If sFilePath = "" Then

       bRetVal = FALSE

 ElseIf sTableName = "" Then

       bRetVal = FALSE

 Else

       Set oDB = Server.CreateObject("ADOX.Catalog")

       On Error Resume Next

oDB.ActiveConnection = ("Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & _     Server.MapPath(sFilePath))

       If Err.number = 0 Then

              bRetVal = FALSE

              For Each Table in oDB.Tables

                     If Table.Name = sTableName Then bRetVal = TRUE

              Next

       Else

              bRetVal = FALSE

       End If

    Set oDB = Nothing

 End If

 fnTableExists = bRetVal

End Function