<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="initApp()">

	<mx:Script>
		<![CDATA[
import mx.controls.Alert;

private var con:SQLConnection;

private function initApp():void
{
	var file:File = File.applicationStorageDirectory.resolvePath("myTestdb.db")
	
	con = new SQLConnection();
	
	try
	{
		con.open(file);
		Alert.show("成功完成");
	}
	catch(error:SQLError)
	{
		Alert.show(error.message);
		Alert.show(error.details);
	}
}


			
/*
import mx.controls.Alert;

private var con:SQLConnection;

private function initApp():void
{
	var file:File = File.applicationStorageDirectory.resolvePath("myTestdb.db")
	
	con = new SQLConnection();
	//在 openAsync() 方法调用操作成功完成时调度
	con.addEventListener(SQLEvent.OPEN,openHandler);
	//SQLConnection 对象的异步操作导致错误时调度
	con.addEventListener(SQLErrorEvent.ERROR,errorHandler);
	
	con.openAsync(file);
}

private function openHandler(evt:SQLEvent):void
{
	Alert.show("成功完成");
}

private function errorHandler(evt:SQLErrorEvent):void
{
	Alert.show("失败");
	Alert.show(evt.error.message);
	Alert.show(evt.error.details);
}
*/
		]]>
	</mx:Script>
	
</mx:WindowedApplication>
