0
我嘗試從Adobe Flash/Air數據庫獲取一些數據。 和它拋出錯誤說:錯誤消息:錯誤#3115:SQL錯誤。 Flash Sql數據庫表錯誤
「錯誤消息:Error#3115:SQL錯誤沒有這樣的表 'favori'」
我的代碼是:
import flash.data.SQLConnection;
import flash.events.SQLErrorEvent;
import flash.events.SQLEvent;
import flash.filesystem.File;
import flash.data.SQLResult;
import flash.data.SQLStatement;
import flash.errors.SQLError;
var conn:SQLConnection = new SQLConnection();
conn.addEventListener(SQLEvent.OPEN, openHandler);
conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
// The database file is in the application storage directory
var folder:File = File.applicationStorageDirectory;
var dbFile:File = folder.resolvePath("debe2.db");
conn.openAsync(dbFile);
function openHandler(event:SQLEvent):void
{
trace("the database was created successfully");
}
function errorHandler(event:SQLErrorEvent):void
{
trace("Error message:", event.error.message);
trace("Details:", event.error.details);
}
var selectStmt:SQLStatement = new SQLStatement();
// A SQLConnection named "conn" has been created previously
selectStmt.sqlConnection = conn;
conn.openAsync(dbFile);
selectStmt.text = "SELECT id, name FROM favori";
selectStmt.addEventListener(SQLEvent.RESULT, resultHandler);
selectStmt.addEventListener(SQLErrorEvent.ERROR, errorHandler2);
selectStmt.execute();
function resultHandler(event:SQLEvent):void
{
var result:SQLResult = selectStmt.getResult();
var numResults:int = result.data.length;
for (var i:int = 0; i < numResults; i++)
{
var row:Object = result.data[i];
var output:String = "id: " + row.itemId;
output += "; name: " + row.itemName;
trace(output);
}
}
function errorHandler2(event:SQLErrorEvent):void
{
trace("Error message:", event.error.message);
trace("Details:", event.error.details);
}
和我谷歌搜索它,大多數人有同樣的問題... 我檢查了我的數據庫與幾個程序看起來不錯,我看到我的表在那裏。 對此有什麼想法?