function check_gived_DataTable_exist_or_not(connect_object,name_of_gived_DataTable) Do_gived_DataTable_exist=false Const adSchemaTables=20 '表明想要得到數(shù)據(jù)庫中“表(table)和視圖(view)的集合” set RecordSet_about_table_and_view_in_DataBase=connect_object.openSchema(adSchemaTables) Do Until RecordSet_about_table_and_view_in_DataBase.EOF if RecordSet_about_table_and_view_in_DataBase("TABLE_TYPE")="TABLE" then if RecordSet_about_table_and_view_in_DataBase("TABLE_NAME")= name_of_gived_DataTable then Do_gived_DataTable_exist=true exit do end if end if RecordSet_about_table_and_view_in_DataBase.movenext Loop
check_gived_DataTable_exist_or_not=Do_gived_DataTable_exist end function
注釋:
connect_object.openSchema(adSchemaTables)這個函數(shù)執(zhí)行后,會得到“數(shù)據(jù)庫中表(table)和視圖(view)的集合”,這是一個ADODB.Recordset類型的數(shù)據(jù)。 if RecordSet_about_table_and_view_in_DataBase("TABLE_TYPE")="TABLE"這句話把檢查范圍縮小為“表(table)”。