View Full Version : Error #1009

02-20-2010, 02:39 AM
I'm working on an AIR app that creates a local database and allows the user to add/edit/delete data into the database. I can get it to add the data, but when I try to delete a row from the db based on the selected item in a datagrid (dg_clients) I get Error #1009: Cannot access a property or method of a null object reference.

Here's the code for the delete function, which is called by clicking a button:

private function deleteClient(eventObj:CloseEvent):void
var stmt:SQLStatement = new SQLStatement();

var selected_client:String = dg_clients.selectedItem.clientid;

if (eventObj.detail==Alert.OK) {
stmt.sqlConnection = sqlConn;
stmt.text = "DELETE FROM clients WHERE clientid=" + selected_client;

<mx:Button x="809" y="10" label="Delete" click='Alert.show("Delete this Client?", "Delete Client", Alert.OK | Alert.CANCEL, this, deleteClient, null, Alert.OK);'/>

any help would be greatly appreciated!