why would you want "qtySum " as variable/ sql parameter when it's an "AS" in the SELECT?
Apologies if I don't understand (highly likely I'm afraid!), but are you not going to have to pull that out of the results in any case e.g. var sum = result.data[i][qtySum] ? So surely you can use a hardcoded string to no detriment? (And I'd rather expect the use of a sql parameter there to be "unexpected" by AIR) I expect I may well have missed the point, however. If so I'm happy to have my education broadened! -----Original Message----- From: flexcoders@yahoogroups.com on behalf of bredwards358 Sent: Mon 11/08/2008 15:40 To: flexcoders@yahoogroups.com Subject: [flexcoders] Using TOTAL and AS in the SQL of a Flex app I really don't know where to post this, as it involves both SQLite and Flex 3, but, I'll try here first. Here's what I have in FlexBuilder: sqlText = "SELECT Up18RODetail.ProductID, TOTAL(Up18RODetail.Qty) AS :qtySum " + "FROM Up18RODetail LEFT JOIN Up18ROHeader ON Up18RODetail.ROID = Up18ROHeader.ROID " + "WHERE Up18ROHeader.DateUploaded Between :startDate AND :endDate " + "GROUP BY Up18RODetail.ProductID " + "HAVING Up18RODetail.ProductID = :prodProdID"; transactionStatement = new SQLStatement(); conn = new SQLConnection(); transactionStatement.sqlConnection = conn; conn.open(dbFile); transactionStatement.addEventListener(SQLEvent.RESULT, calcUsePercentResult); transactionStatement.addEventListener(SQLErrorEvent.ERROR, errorHandler); transactionStatement.text = sqlText; transactionStatement.parameters[":startDate"] = startDate; transactionStatement.parameters[":endDate"] = endDate; transactionStatement.parameters[":qtySum"] = qtySum; //String variable transactionStatement.parameters[":prodProdID"] = prodDataArray[i].ProductID transactionStatement.execute(); Now, the SQL actually works in the SQLite database browser, however it throws a SQL syntax error when I try to run it in my flex app and I'm not sure why. The error reads SQLError: 'Error #3115: SQL Error.', details:'near ":qtySum": syntax error', operation:'execute'. I could sure use a hand here, thanks in advance. Brian Ross Edwards Tech-Connect LLC ______________________________________________________________________ This communication is from Primal Pictures Ltd., a company registered in England and Wales with registration No. 02622298 and registered office: 4th Floor, Tennyson House, 159-165 Great Portland Street, London, W1W 5PA, UK. VAT registration No. 648874577. This e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail or by telephoning +44(0)20 7637 1010. Please then delete the e-mail and do not disclose its contents to any person. This email has been scanned for Primal Pictures by the MessageLabs Email Security System. ______________________________________________________________________
<<winmail.dat>>