Solved

Adobe AIR/SQLlite ArrayCollection error

Posted on 2009-05-12
1
586 Views
Last Modified: 2013-11-11
I am connecting to a SQLite database. I want to return the results as an array collection to display in a datagrid, but i am getting the following error:

Severity and Description      Path      Resource      Location      Creation Time      Id
Type was not found or was not a compile-time constant: data. [Generated code (use -keep to save): Path: data-generated.as, Line: 156, Column: 14]            hitAndRun      Unknown      1242153146345      3006

When i debug the application the results are returned correctly in an array but there is an error when my datagrid isnt commented out. thanks in advance.
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" 
	layout="vertical" creationComplete="init()">
	
	<mx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			
			private var sqlConn:SQLConnection;
			private var sqlFile:File;
			
			[Bindable]
			private var acPeeps:ArrayCollection;
			
			private function init():void
			{
				sqlFile = File.applicationStorageDirectory.resolvePath("motility.db");
				sqlConn = new SQLConnection();
				sqlConn.open(sqlFile, SQLMode.CREATE);
				
				var stmt:SQLStatement = new SQLStatement();
				stmt.sqlConnection = sqlConn;
				stmt.text = "CREATE TABLE IF NOT EXISTS motility(" + 
						"playerid INTEGER PRIMARY KEY AUTOINCREMENT, " + 
						"date DATE, " + 
						"LtoRmostinarowBB TEXT, " + 
						"RtoLmostinarowBB TEXT, " + 
						"LtoRhitsBB TEXT, " + 
						"RtoLhitsBB TEXT)";
 
				 stmt.execute();
				 var result:SQLResult = stmt.getResult();
				 trace("Table was created");
			}
			
			private function createRecord():void
			{
				var stmt:SQLStatement = new SQLStatement();
				stmt.sqlConnection = sqlConn;
				stmt.text = 
				"INSERT INTO motility(" + 
				"date, LtoRmostinarowBB, RtoLmostinarowBB, " + 
				"LtoRhitsBB, RtoLhitsBB) " + 
				"VALUES (" + 
				"'03-12-2009', '18', '4', '30', '33')";
 
				stmt.execute();
				var result:SQLResult = stmt.getResult();
				trace("Data inserted");
			}
			
			private function retrieveData():void
			{
			
				var stmt:SQLStatement = new SQLStatement();
				stmt.sqlConnection = sqlConn;
				stmt.text = "SELECT * FROM motility";
				stmt.execute();
				var result:SQLResult = stmt.getResult();
				
				acPeeps = new ArrayCollection(result.data);
				
			}
			
		]]>
	</mx:Script>
	
	
	
	<mx:Button x="284" y="158" label="Insert Data" click="createRecord()"/>
	<mx:Button x="284" y="158" label="Retreive Data" click="retrieveData()"/>
	<!--<mx:DataGrid dataProvider="{acPeeps}"/>-->
	
</mx:WindowedApplication>

Open in new window

0
Comment
Question by:rarid122481
1 Comment
 
LVL 5

Accepted Solution

by:
Fuzzy_Logic_ earned 500 total points
ID: 24373392
The only thing I can see wrong here is that the date value you are trying to insert is not of the correct format.

It should be: YYYY-MM-DD

try changing 03-12-2009 to 2009-12-03 (I'm assuming you mean 3rd December)

Regards FL
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Where to download Adobe Flash Player 11.9.900.170 5 1,392
Video sharing with user login 3 215
How  to reduce the .AVI file size of 90GB 4 373
Running Guacamole on port 80 5 298
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question