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
B4X:
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
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:
B4X:
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
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
If the first line logged says 0, then you have an empty database. It should log the number of records in the database file. You certianly should check on how the file is being created.
Change or comment your code line like below. Now run and see what the log shows.
B4X:
Cursor1=SQL1.ExecQuery("SELECT pregunta,r1,r2,r3,r4 FROM table1 WHERE id=" &preg)
'Change above line to this for a test. Then run and see what the log shows.
Cursor1=SQL1.ExecQuery ("SELECT * FROM table1")
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.