# Extracting Strings from Object (SQLite Database)

**URL:** <https://forum.kirupa.com/t/extracting-strings-from-object-sqlite-database/331824>\
**Category:** flash\
**Created:** [October 31, 2013, 5:03pm UTC](https://forum.kirupa.com/t/extracting-strings-from-object-sqlite-database/331824 "2013-10-31T17:03:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PEProgrammer](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@PEProgrammer](https://forum.kirupa.com/u/PEProgrammer)\
**Post date:** [October 31, 2013, 5:03pm UTC](https://forum.kirupa.com/t/extracting-strings-from-object-sqlite-database/331824/1 "2013-10-31T17:03:53Z")

</div>

Hello,

I am wondering if I can kill two birds with one stone here. I am trying to SELECT items from an SQLite database, and I believe I am doing that successfully, even though my trace statements are returning a null.

All of the tutorials I have read, they take the items from the db and puts them into a data grid as a contact manager or something. I want to put the objects in an array and use them as a random name generator. When you get the result.data() I think it returns just an object.

So… How do I extract String information from an object and an SQL Object. Is there a function in the object class or the result class that Im missing? Here is some of my code. Thanks for the help!

```auto
import flash.data.SQLConnection;import flash.filesystem.File;
import flash.data.SQLStatement;
import flash.data.SQLResult;

var connection:SQLConnection;
var selectNames:SQLStatement;

generate.addEventListener(MouseEvent.CLICK, openConnection);

function openConnection(e:MouseEvent):void
{
var randomDb:File = File.desktopDirectory.resolvePath("classes.db");
connection = new SQLConnection;
connection.addEventListener(SQLEvent.OPEN, onOpen);
connection.addEventListener(SQLErrorEvent.ERROR, onDBError);
connection.openAsync(randomDb);
}

function onDBError(event:SQLErrorEvent):void
{
	trace ("The Database Has An Error!");
}

function onOpen(event:SQLEvent):void
{
	trace ("Successful");
	
	var selectNames = new SQLStatement;
	selectNames.sqlConnection = connection;
	var names:String = "SELECT firstname, lastname FROM sections WHERE (teacher = 'kohn')";
	selectNames.text = names; 
	selectNames.addEventListener(SQLEvent.RESULT, onAddComplete);
    selectNames.addEventListener(SQLErrorEvent.ERROR, onDBError);
    selectNames.execute();
}

function onAddComplete(event:SQLEvent):void
{
	var selectNames:SQLStatement = event.target as SQLStatement;
	var results:SQLResult = selectNames.getResult();
	trace ("Check Values");
	trace (results);
}

```
