首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 媒体动画 > flex >

flex使用sqlite异常,请各位指教

2012-02-11 
flex使用sqlite错误,请各位指教Java codeprivate function getSQLFile():void{//get sql filetrace(File.a

flex使用sqlite错误,请各位指教

Java code
       private function getSQLFile():void{              //get sql file               trace(File.applicationDirectory.nativePath+"/db.db");              var _f:File = new File(File.applicationDirectory.nativePath+"/db.db");              if(!_f.exists){                  initdb(_f);  //if file is not existed create                  initTable();  //if table is not existed create              }              else              {                  initdb(_f);              }          }            private function initdb(_file:File):void{              try{                  conn = new SQLConnection();                  conn.open(_file);                  stmt = new SQLStatement();                  stmt.addEventListener(SQLEvent.RESULT,getResult);                  stmt.addEventListener(SQLErrorEvent.ERROR,resultErr);                  stmt.sqlConnection = conn;              }catch(ex:SQLError){                  trace("init the database error:"+ex.message);              }          }            private function initTable():void{              try{                  var 1_table:String = "CREATE TABLE IF NOT EXISTS t_aa("                                           +"id INTEGER PRIMARY KEY AUTOINCREMENT,"                                           +"title TEXT,"                                            +"content TEXT,"                                           +"time TEXT,"                                           +"statas NUMERIC"                                           +")";                  stmt.text = 1_table;                  stmt.execute();                  var 2_table:String = "CREATE TABLE IF NOT EXISTS t_bb(id INTEGER PRIMARY KEY AUTOINCREMENT,title text,aa numeric,bb numeric,dcc text,dd text)";                  if(stmt == null){                      this.initdb(new File(File.applicationDirectory.nativePath+"/db.db"));                  }                  stmt.text = 2_table;                  stmt.execute();              }catch(ex:SQLError){                  trace("init table error:"+ex.message);              }              //stmt.cancel();          }  

结果在程序运行初始化的时候出现了个出错如下: 
Java code
Error: Error #3108: Operation is not permitted when the SQLStatement.text proper  ty is not set.      at Error$/throwError()      at flash.data::SQLStatement/checkAllowed()      at flash.data::SQLStatement/checkReady()      at flash.data::SQLStatement/execute()      at db::SQLLiteConntion/getResult()[E:\project\Adobe\flex\NoteBook\src\db\SQLLit  eConntion.as:156]      at flash.data::SQLStatement/internalExecute()      at flash.data::SQLStatement/execute()      at db::SQLLiteConntion/initTable()[E:\project\Adobe\flex\NoteBook\src\db\SQLLit  eConntion.as:114]      at db::SQLLiteConntion/getSQLFile()[E:\project\Adobe\flex\NoteBook\src\db\SQLLi  teConntion.as:76]      at db::SQLLiteConntion()[E:\project\Adobe\flex\NoteBook\src\db\SQLLiteConntion.  as:65]      at NoteBook/init()[E:\project\Adobe\flex\NoteBook\src\NoteBook.mxml:99]      at NoteBook/___NoteBook_WindowedApplication1_creationComplete()[E:\project\Adob  e\flex\NoteBook\src\NoteBook.mxml:2]      at flash.events::EventDispatcher/dispatchEventFunction()      at flash.events::EventDispatcher/dispatchEvent()      at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\  framework\src\mx\core\UIComponent.as:9298]      at mx.core::UIComponent/set initialized()[C:\autobuild\3.2.0\frameworks\project  s\framework\src\mx\core\UIComponent.as:1169]      at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\framew  orks\projects\framework\src\mx\managers\LayoutManager.as:718]      at Function/http://adobe.com/AS3/2006/builtin::apply()      at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\pr  ojects\framework\src\mx\core\UIComponent.as:8628]      at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\pro  jects\framework\src\mx\core\UIComponent.as:8568] 


就是在运行第一个 stmt.text=1_table 后执行 stmt.execute();出错...对sqlite不熟,在网上找了N久没有结果,有人遇到类似错误不?请指教...谢谢



[解决办法]
楼主用了asSQL-Beta2.8.swc??

呵呵!前段时间我也尝试了下用Flex脱离后台

没怎么深入研究!先路过~~~

热点排行