国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

檢查access數(shù)據(jù)庫中是否存在某個名字的表的asp代碼

2024-05-04 10:57:04
字體:
供稿:網(wǎng)友
可以把本功能寫成一個函數(shù),函數(shù)的處理過程描述如下:

首先調(diào)用adodb.connection對象中的openSchema函數(shù),這樣會得到一個Recordset,其中每一條“紀(jì)錄”對應(yīng)著數(shù)據(jù)庫中的一張表,“紀(jì)錄”的每個“字段”包含了對應(yīng)表的某方面信息。其中TABLE_NAME字段包含了對應(yīng)表的名稱
然后遍歷這個Recordset,如果“當(dāng)前紀(jì)錄”的TABLE_NAME字段的值和要查找的表的名字一樣,證明要查找的表存在。
函數(shù)如下所示:

復(fù)制代碼 代碼如下:

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)”。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 枞阳县| 东丰县| 修文县| 内丘县| 定南县| 稷山县| 孟村| 龙川县| 简阳市| 阿图什市| 通渭县| 岳池县| 临邑县| 扬州市| 神池县| 吉隆县| 灌阳县| 长治市| 青阳县| 湾仔区| 平邑县| 榕江县| 西安市| 莆田市| 明光市| 察隅县| 龙陵县| 遵义市| 东兴市| 新安县| 常州市| 天津市| 安塞县| 上高县| 清河县| 巫溪县| 泸定县| 泸定县| 瑞丽市| 瑞安市| 铁岭县|