flex sqllite 操作

用户资料管理系统。flex 操作sqlite数据库的例子。要的给我发邮件
一些源码:
import mx.controls.Alert;
private var conn:SQLConnection;
private var SQLStatetmt:SQLStatement;
private var file:File;
private var arr:Array=["姓名","性别","年龄","手机号码","家庭号码","QQ号码","邮箱号码"];

private function init():void
{
try
{
file=File.applicationDirectory.resolvePath("UserInfoDB.db");
conn=new SQLConnection();
SQLStatetmt=new SQLStatement();
conn.open(file);//打开SQL连接
}
catch(error:SQLError)
{
Alert.show(error.message);
Alert.show(error.details);
}
createTable();

}
private function createTable():void
{
try
{
SQLStatetmt.sqlConnection=conn;
var sql:String ="CREATE TABLE IF NOT EXISTS TelInfoTable(Id INTEGER PRIMARY KEY AUTOINCREMENT," +
        "name TEXT unique,sex TEXT,age numeric CHECK(200>age>0),mobilephone TEXT," +
        "homephone TEXT,qq TEXT,eMails TEXT)"; 
SQLStatetmt.text=sql;
SQLStatetmt.execute();    
}
catch(error:SQLError)
{
Alert.show(error.message);
Alert.show(error.details);
}
}
private function createTableOK(event:SQLEvent):void
{
Alert.show("ccccccc");
insertTable();
}


private function selectTable():void
{
try
{
//SQLStatetmt.sqlConnection=conn;
SQLStatetmt.text="select * from  TelInfoTable";
SQLStatetmt.execute();
var result:SQLResult = SQLStatetmt.getResult();
if(result.data == null)
{
Alert.show("查不到相应的数据");
return;
}
var obj:Object=result.data;
datagrid1.dataProvider=obj;
var len:int=result.data.length;
}
catch(error:SQLError)
{
Alert.show(error.message);
Alert.show(error.details);
}
   
}

你可能感兴趣的:(sql,sqlite,qq,Flex)