可否請您告訴我如何檢查表名是否存在於數據庫或現在。我需要統計表中的元素數量。但如果沒有表存在在分貝然後它會出錯。?如何檢查sqlite數據庫中存在的表名(手機間隙)
如果數據庫中沒有表(名稱= caseName_h),那麼它會給出錯誤。所以我需要檢查。如果存在這個表,那麼我需要計算元素的數量。 我嘗試這樣
db.transaction(function (tx) {
tx.executeSql('PRAGMA table_info(a)', [],
function(tx, results) {
alert("hh");
if (results.rows.length == 0) {
alert("No")
} else {
tx.executeSql('SELECT COUNT(*) FROM a' , [],
function(tx, results) {
alert("Yes");
});
}
});
});
能否請您解釋一下深..? –
Ehis不工作.. :( –
你的錯誤描述沒有用 –