views:

27

answers:

3
import mx.controls.Alert;

package dbconfig // error line here
{
    public class DBConn
    {
        private var dbConn:SQLConnection;
        private var dbFile:File;

        public function DBConn()
        {
            this.openConnection(); 
        }

        public function openConnection(){
            dbFile = File.applicationStorageDirectory.resolvePath("accounting.sqlite");
            dbConn = new SQLConnection();

            try 
            {
                dbConn.open(dbFile);
                Alert.show("asdf");
            }
            catch(e:SQLError)
            {
                Alert.show("SQL Error Occured: ", e.message);
            }
        }
    }
}
+2  A: 

You need to place the import inside of the package definition:

package dbconfig
{
    import mx.controls.Alert;

    public class DBConn
    {
        private var dbConn:SQLConnection;
        private var dbFile:File;

        public function DBConn()
        {
            this.openConnection(); 
        }

        public function openConnection(){
            dbFile = File.applicationStorageDirectory.resolvePath("accounting.sqlite");
            dbConn = new SQLConnection();

            try 
            {
                dbConn.open(dbFile);
                Alert.show("asdf");
            }
            catch(e:SQLError)
            {
                Alert.show("SQL Error Occured: ", e.message);
            }
        }
    }
}
James Fassett
thnx. Do you happen to know any CRUD examples tutorials for FLEX Air and sqlite. I've been building this application but i get stuck a lot on simple probelms. started flex only a few days ago so some tutorials on CRUD operations would help me a lot.
soden
A: 

Yes, unlike Java, you must import all classes you are going to use, even if you fully qualify them. Judging by the tags I assume you know this, but the SQLConnection and File are Air only, so wouldn't run in the normal flash player.

mezmo
I've been building this application but i get stuck a lot on simple probelms. started flex only a few days ago so some tutorials on CRUD operations would help me a lot.
soden
A: 

crud and sqlite tutorial here: http://www.peterelst.com/blog/2008/04/07/introduction-to-sqlite-in-adobe-air/

Arpinum