sql "table not found"

tremara1

Active Member
Licensed User
Longtime User
I am just trying to port a ppc app to android. I have just started and when I try to load a field from the db into a spinner I get a message table not found. I have based the code on the sql tutorial code. I am using emulator. It seems to open the db ok but it fails at line 20. Code attached.
Trevor
Ballarat
Victoria
Australia
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Sub Activity_Create(FirstTime As Boolean)
    If SQL1.IsInitialized = False Then
        Msgbox("x","y")
        SQL1.Initialize(File.DirDefaultExternal, "meds", True)
    End If
    activity.LoadLayout("pill.bal")
    Dim Cursor As Cursor
    Cursor = SQL1.ExecQuery("SELECT name FROM main")
    For i = 0 To Cursor.RowCount - 1
        Cursor.Position = i
        spnrName.Add(Cursor.GetString("name"))
    Next
    Cursor.Close
End Sub
Where are you creating the table?
 
Upvote 0

tremara1

Active Member
Licensed User
Longtime User
d'oh......

Thanks for your reply, as usual I did not read all the detail regarding files and there accessibility. I was trying to access an existing db file. I have been able to access it by copying it from the dirAsset to the sd card (dirDefaultExternal). Is this the correct way to access an existing db deployed with the app. I use an if exists to see if it exists before copying db. I realise you could create a new db when it does not have any data when new, but I may want to supply a db with data already in it. My only concern is if the user adds new data and has to reinstall the app for some reason, how can you keep the updated db. My understanding is I cannot copy it back to dirAsset. Thanks again.
 
Last edited:
Upvote 0

tremara1

Active Member
Licensed User
Longtime User
great...thanks

Thanks for your patience....nearly got my first app done will put it up for a look soon.
 
Upvote 0

siddsg

Member
Licensed User
Longtime User
Hello,
I am getting an error "android.database.sqlite.SQLiteException: no such table: QueriesTable (code 1): , while compiling".
Would you know why?

Thanks,
Siddharth
 
Upvote 0
Top