Problem with database sqllite

fanfalveto

Active Member
Licensed User
Longtime User
I have a database with several fields. To row 250 the program reads well, but ignores 251 onwards. please if you can help? thanks
 
in globlals
Code: Copy
dim preg as int=1
In activity_create
Code: Copy
If FirstTime = True AND File.Exists(File.DirInternal, "base.db") = False Then
        File.Copy(File.DirAssets, "base.db", File.DirInternal, "base.db")      
    End If      
    SQL1.Initialize(File.DirInternal, "base.db", True)
then
Code: Copy
Sub juego
Label8.Text=preg
Cursor1=SQL1.ExecQuery("SELECT pregunta,r1,r2,r3,r4 FROM table1 WHERE id=" &preg)
    For i = 0 To Cursor1.RowCount - 1   
      Cursor1.Position = i
    la1=(Cursor1.GetString("pregunta"))
   r1=(Cursor1.GetString("r1"))
   r2=(Cursor1.GetString("r2"))
   r3=(Cursor1.GetString("r3"))
   r4=(Cursor1.GetString("r4"))
   If pos=1 Then
   Label1.Text=la1
   Label2.Text=r1
   Label3.Text=r2
   Label4.Text=r3
   Label5.text=r4
   Else If pos =2 Then
   Label1.Text=la1
   Label3.Text=r1
   Label4.Text=r2
   Label5.Text=r3
   Label2.text=r4
   Else If pos =3 Then
   Label1.Text=la1
   Label4.Text=r1
   Label5.Text=r2
   Label2.Text=r3
   Label3.text=r4
   Else If pos =4 Then
   Label1.Text=la1
   Label5.Text=r1
   Label2.Text=r2
   Label3.Text=r3
   Label4.text=r4
   End If
   Next
   Cursor1.Close
   Label7.Text="Nivel: "&nive
   Label6.Text="Puntos: "&punto
   Label9.Text="Fallos: "&fallo
End Sub
if click a button then
Code: Copy
preg=preg+1
 
Upvote 0
Replace your sub with this or just add the two logging lines marked with comments to yours. Run the app and see what the log shows:

Code: Copy
Sub juego
   Label8.Text=preg
   Cursor1=SQL1.ExecQuery("SELECT pregunta,r1,r2,r3,r4 FROM table1 WHERE id=" &preg)
   Log(Cursor1.RowCount - 1)   'Added for logging
   For i = 0 To Cursor1.RowCount - 1
      Cursor1.Position = i
      Log(Cursor1.Position)   'Added for logging
      la1=(Cursor1.GetString("pregunta"))
      r1=(Cursor1.GetString("r1"))
      r2=(Cursor1.GetString("r2"))
      r3=(Cursor1.GetString("r3"))
      r4=(Cursor1.GetString("r4"))
      If pos=1 Then
         Label1.Text=la1
         Label2.Text=r1
         Label3.Text=r2
         Label4.Text=r3
         Label5.text=r4
      Else If pos =2 Then
         Label1.Text=la1
         Label3.Text=r1
         Label4.Text=r2
         Label5.Text=r3
         Label2.text=r4
      Else If pos =3 Then
         Label1.Text=la1
         Label4.Text=r1
         Label5.Text=r2
         Label2.Text=r3
         Label3.text=r4
      Else If pos =4 Then
         Label1.Text=la1
         Label5.Text=r1
         Label2.Text=r2
         Label3.Text=r3
         Label4.text=r4
      End If
   Next
   Cursor1.Close
   Label7.Text="Nivel: "&nive
   Label6.Text="Puntos: "&punto
   Label9.Text="Fallos: "&fallo
End Sub
 
Upvote 0
I don´t know only see in log 0 when program runs to row 250 and after -1.
may be is problen the program to make the database don´t make more than 250 rows.i do that with sqlite expert
 
Upvote 0
the data base is not empty,i play the game to row 250 and it´s ok,i see the database in dat/data/myprogram/files and only there are 250 rows.
sure is a problem whit sql expert,i try to create another database from 251 to 500 or use another application to create.
 
Upvote 0
Back
Top