Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-01-2010, 08:30 PM   #1
flexable
Member
 
Join Date: May 2010
Location: india
Posts: 68
Default Deleting a column from a datgrid

The program is running fine bt nt able to select the column n delete it...i hav written the delet()......n pointed out where i gt the error......it says undefined property employees.


Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
	<![CDATA[
import mx.controls.Alert;
import flash.data.SQLConnection;
import flash.events.SQLErrorEvent;
import flash.data.SQLStatement;
import flash.events.SQLEvent;
import flash.filesystem.File;
import mx.collections.ArrayCollection;

[Bindable] 

// main function connection object creation
private var conn:SQLConnection = new SQLConnection();
private function init():void
	{

 var dbFile:File = File.applicationStorageDirectory.resolvePath("Sample.db");
conn.open(dbFile);
 var createStmt:SQLStatement = new SQLStatement();
    createStmt.sqlConnection = conn;
var sql:String = 
    "CREATE TABLE IF NOT EXISTS EMPLOYEES ( EMPLOYEE_ID INTEGER PRIMARY KEY AUTOINCREMENT ,F_NAME TEXT,L_NAME TEXT)";
createStmt.text = sql;
createStmt.execute();

}

// select function

 private function select():void
{
	
 var selectStmt:SQLStatement = new SQLStatement();
selectStmt.sqlConnection = conn;

selectStmt.text = "SELECT * FROM EMPLOYEES";

selectStmt.execute();
dg.dataProvider=selectStmt.getResult().data;


}

// insert fuction
private function insert():void
{

 var insertStmt:SQLStatement = new SQLStatement();
insertStmt.sqlConnection = conn;
 var sqls:String = "INSERT INTO EMPLOYEES (F_NAME , L_NAME) VALUES(?,?)"; 
  insertStmt.parameters[0] = fname.text;
  insertStmt.parameters[1] = lname.text;
   insertStmt.text = sqls;
insertStmt.execute();

select();
}

// delete function
private function delet():void
{
		
 var Stmt:SQLStatement = new SQLStatement();
Stmt.sqlConnection = conn;
Stmt.text = "DELETE FROM EMPLOYEES WHERE EMPLOYEE_ID= ?";
error//Stmt.parameters[0]=employees.selectedItem.EMPLOYEE_ID;
Stmt.execute();
select();

}

]]>
</mx:Script>
	<mx:TextInput x="75" y="61" id="fname" />
	<mx:TextInput x="260" y="61" id="lname"/>
	<mx:DataGrid x="75" y="107" id="dg" width="345">
		<mx:columns>
			<mx:DataGridColumn headerText="firstname" dataField="F_NAME"/>
			<mx:DataGridColumn headerText="lastname" dataField="L_NAME"/>
	
		</mx:columns>
	</mx:DataGrid>
	<mx:Button x="474" y="61" id="b1" label="insert"  click="insert()"/>
	<mx:Button x="474" y="124" label="delete" id="d1" click="delet()"/>
	
</mx:WindowedApplication>
flexable is offline   Reply With Quote
Old 06-01-2010, 09:44 PM   #2
Peter Cowling
quantum tunneler
 
Join Date: Sep 2008
Location: London, UK
Posts: 882
Default

An Adobe Air question...
Peter Cowling is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:28 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.