SQL Lite table not found

Rusty

Well-Known Member
Licensed User
Longtime User
On the ADB emulator, both of the following work flawlessly; on the Velocity Cruz R101 the exact code fails with "Answers table not found".
I have created two cursors/queries against the same SQL Lite database. A simple query against Answers (table), works perfectly, even on the R101. A compound query against 4 tables, including the Answers table fails with the above error.
(Variables Cs.SurveyID etc. are defined and have valid values in all cases)

...
DBSurvey = "survey.db3"
SDcardData = File.DirRootExternal & "/data"
Dim SQLSurvey As SQL
SQLSurvey.Initialize(SDcardData, DBSurvey, False)

Simple Query:
LanguageCursor = SQLSurvey.ExecQuery("Select * FROM Answers WHERE SurveyID='" & cs.SurveyID & "'")
languagecursor.Position = 1
Log ("Answer " & LanguageCursor.GetString("Answers.AnswerText"))

Compound Query:
Dim QuestionCursor As Cursor
Dim Cmd As StringBuilder
Cmd.Initialize
CMD.Append("SELECT Question.*, Answers.*, SuperQuestion.* ")
CMD.Append( "FROM (Question " )
CMD.Append( "INNER JOIN Answers ON Question.SurveyID = Answers.SurveyID " )
CMD.Append( "AND Question.QuestionNo = Answers.QuestionNo " )
CMD.Append( "AND Question.QuestionLanguage = Answers.AnswerLanguage) ")

CMD.Append( "LEFT JOIN SuperQuestion ON Question.SurveyID = SuperQuestion.SurveyID " )
CMD.Append( "AND Question.QuestionNo = SuperQuestion.QuestionNo " )
CMD.Append( "AND Question.QuestionLanguage = SuperQuestion.QuestionLanguage ")

CMD.Append( "WHERE (Question.SurveyID ='" & CS.SurveyID & "') " )
CMD.Append( "AND (Question.QuestionLanguage ='" & CS.SurveyLanguage & "') " )
CMD.Append( "AND (Question.QuestionNo = " & QuestionNumber & ") " )
CMD.Append( "ORDER BY Question.QuestionNo, Answers.AnswerNo " )
QuestionCursor = SQLSurvey.ExecQuery(CMD)
QuestionCursor.Position = 0
LOG("Answer " & QuestionCursor.getstring("Answers.AnswerText"))

Fails no such table: Answers:
Both of these examples work perfectly on the ADB simulator:
Name: VelocityCruz
Path:...
Target: Android 2.2 (API level 8)
Skin: 800x600
SD Card: 4000M
hw.lcd.density: 160

Any suggestions? Thanks
 
Last edited:

Rusty

Well-Known Member
Licensed User
Longtime User
Good thought. I'll split it up into smaller queries and give it a try. Thanks
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
Ok. I broke the complex statement into single table, no joins. Even though I think it is not a memory problem because the resultant queries have only 5 results, it seems to work without the joins...
Thanks for the help!
 
Upvote 0
Top