private var conn:SQLConnection=new SQLConnection();
private var stmt:SQLStatement=new SQLStatement();
private var filedb:File=File.applicationStorageDirectory.resolvePath("School.db");
private function initApp():void{
conn.addEventListener(SQLEvent.OPEN,createTable);
conn.addEventListener(SQLErrorEvent.ERROR,error);
conn.open(filedb);
}
private function createTable():void{
stmt.sqlConnection=conn;
var sql:String="create table if not exists Notes" +
"(noteid integer primary key autoincrement" +
"title text,content text,publisher text)";
stmt.text=sql;
stmt.addEventListener(SQLErrorEvent.ERROR,error);
stmt.addEventListener(SQLEvent.RESULT,selectHandler);
stmt.execute(-1,null);//在运行的时候老是说我这一行有问题!
}
private function error(e:SQLErrorEvent):void{
Alert.show("Details:",e.error.message);
}
private function selectHandler():void{
Alert.show("successful!");
}
以下是错误提示:
ArgumentError: Error #1063: Argument count mismatch on localdata/createTable(). Expected 0, got 1.
at flash.data::SQLConnection/internalOpen()
at flash.data::SQLConnection/open()
at localdata/initApp()[C:\workspace\windowsoft\src\localdata.mxml:30]
at localdata/___localdata_WindowedApplication1_creationComplete()[C:\workspace\windowsoft\src\localdata.mxml:5]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:12528]
at mx.core::UIComponent/set initialized()[E:\dev\4.x\frameworks\projects\framework\src\mx\core\UIComponent.as:1627]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:759]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.x\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072]
请大家帮帮忙!谢谢了!作者: lalo 时间: 2010-8-31 14:55