That's not really a good way to go about using parameters with SQLite and
you'll continue to have type issues. 

 

Everything is explained at the following link, including the solution to
your problem:

http://livedocs.adobe.com/flex/3/html/help.html?content=SQL_07.html

 

!k

 

  _____  

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of bredwards358
Sent: Friday, May 16, 2008 1:19 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] SQL Lite syntax issue, need something cleared up
regarding SELECT

 

While working on the login functionality of the application I'm
developing, I noticed that SQL seems to be interpereted differently
than what I'm used to. Here's my current select statement that I'm
using for validation:

sqlText = "SELECT * FROM Up18Technicians WHERE TechName = " + userName
+ " AND Password = " + pass;

Which translates to:

SELECT * FROM Up18Technicians WHERE TechName = Ross AND Password = 358029

Now, when the application gets to the execute portion, it throws this
error:

SQLError: 'Error #3115: SQL Error.', details:'no such column: Ross',
operation:'execute'
at flash.data::SQLStatement/internalExecute()
at flash.data::SQLStatement/execute()
at
MatMgr::DataManager/techLogin()[C:\Tech_Connect\MatMgr_Proto\src\MatMgr\Data
Manager.as:453]
at
MatMgr_Proto/login()[C:\Tech_Connect\MatMgr_Proto\src\MatMgrProtoSource.as:2
10]
at
MatMgr_Proto/__btnLogin_click()[C:\Tech_Connect\MatMgr_Proto\src\MatMgr_Prot
o.mxml:18]

This indicates that it is trying to find columns by the name of what
was entered instead of trying to find values in those columns matching
what I entered. I looked up SQL as its understood by SQL lite, but it
seems a bit confusing and I'm unsure if it's even the problem. If it
is, then I'm just wondering if it may have something to with perhaps
the "AND" keyword isn't understood or maybe there's something up with
how I'm using the WHERE clause.

Here's the function I'm using to perform this in case it helps:

public function techLogin(userName:String, pass:String):void
{ //This loads information needed to login technicians
sqlText = "SELECT * FROM Up18Technicians WHERE TechName = " +
userName + " AND Password = " + pass;
trace(sqlText);
selectStatement = new SQLStatement();
conn = new SQLConnection();
selectStatement.sqlConnection = conn;
conn.open(dbFile);
selectStatement.addEventListener(SQLEvent.RESULT, selectTechLoginResult);
selectStatement.addEventListener(SQLErrorEvent.ERROR, errorHandler);
selectStatement.text = sqlText;
selectStatement.execute(); //Error happens here, doesn't go any further
}

 

Reply via email to