日期:2014-05-16  浏览次数:20504 次

flex连接mysql数据库
<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
  xmlns:mysql="com.maclema.mysql.mxml.*">
  <mx:Script>
   <![CDATA[
    import mx.controls.Alert;
    import com.maclema.mysql.events.MySqlErrorEvent;
    import com.maclema.mysql.mxml.MySqlService;
    import com.maclema.util.ResultsUtil;
 
    private function sendToMysql():void{
     service.send("SELECT * FROM user_table");    
    }
    private function handleError(e:MySqlErrorEvent):void{
      Alert.show(e.msg);
    }
   ]]>
  </mx:Script>
 <mysql:MySqlService  id="service"
   hostname="localhost" port="3306" username="root" password="123" 
   database="db_connect" autoConnect="true" connect="sendToMysql()" 
   sqlError="handleError(event)" />
 
  <mx