i've a sqlite database.
when i've do a select i got an error.
this is the code
B4X:
Sub cmdTutte_Click
Dim frasi As String
Dim n As Float
lstfrasi.Clear
n=SQL1.ExecQuerySingleResult("SELECT count(*) FROM TB_TEMI")
Dim Cursor As Cursor
Cursor = SQL1.ExecQuery("SELECT TITOLO, TRACCIA FROM TB_TEMI where titolo!='z' order by TITOLO")
For i = 0 To Cursor.RowCount - 5
Cursor.Position = i
lstfrasi.AddTwoLines (Cursor.getstring("TITOLO"), Cursor.getstring("TRACCIA"))
Next
Cursor.Close
End Sub
Sub cmdTutte_Click
Dim frasi As String
Dim n As Float
Dim dbTITOLO, dbTRACCIA As String '<--Add this
lstfrasi.Clear
n=SQL1.ExecQuerySingleResult("SELECT count(*) FROM TB_TEMI")
Dim Cursor As Cursor
Cursor = SQL1.ExecQuery("SELECT TITOLO, TRACCIA FROM TB_TEMI where titolo != 'z' order by TITOLO")
For i = 0 To Cursor.RowCount - 5
Cursor.Position = i
'And these 2 lines
dbTITOLO = Cursor.getstring("TITOLO")
dbTRACCIA = Cursor.getstring("TRACCIA")
lstfrasi.AddTwoLines(dbTITOLO, dbTRACCIA)
Next
Cursor.Close
End Sub
1- There's no 'Casual.png' included in your project. (I have commented that line - Line 58)
2- Your DB was sort of corrupted that's why you were getting those BLOB errors, it was due to the CORPO column having a HUGE text (I've fixed that), maybe your SQLite editor got confused or something.
3- There's no 'modididire" table (Line 266) you will have to correct that.
1- There's no 'Casual.png' included in your project. (I have commented that line - Line 58)
2- Your DB was sort of corrupted that's why you were getting those BLOB errors, it was due to the CORPO column having a HUGE text (I've fixed that), maybe your SQLite editor got confused or something.
3- There's no 'modididire" table (Line 266) you will have to correct that.
1- There's no 'Casual.png' included in your project. (I have commented that line - Line 58)
2- Your DB was sort of corrupted that's why you were getting those BLOB errors, it was due to the CORPO column having a HUGE text (I've fixed that), maybe your SQLite editor got confused or something.
3- There's no 'modididire" table (Line 266) you will have to correct that.
dim n as int
n=rnd(20)
Dim Cursor As Cursor
Cursor = SQL1.ExecQuery("SELECT id, titolo, traccia, corpo FROM tb_temi WHERE id=[COLOR="Red"]n[/COLOR]")
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
Msgbox ("Traccia: " & traccia & CRLF & CRLF & corpo, titolo)
Next
Cursor.Close
n is the variable of program. how can i do it?
noe i'm doing so, but is there anywau to do it in the query??
dim n as int
B4X:
n=rnd(20)
Dim Cursor As Cursor
Cursor = SQL1.ExecQuery("SELECT id, titolo, traccia, corpo FROM tb_temi WHERE id=[COLOR="Red"]n[/COLOR]")
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
if id=n then
Msgbox ("Traccia: " & traccia & CRLF & CRLF & corpo, titolo)
end if
Next
dim n as int
Dim Option As String
n=rnd(20)
Option = "<font color="&Quote&"Red"&Quote&">"&n&"</font>"
Dim Cursor As Cursor
Cursor = SQL1.ExecQuery2("SELECT id, titolo, traccia, corpo FROM tb_temi WHERE id= ?",Array As String(Option))
For i = 0 To Cursor.RowCount - 1
Cursor.Position = i
Msgbox ("Traccia: " & traccia & CRLF & CRLF & corpo, titolo)
Next
Cursor.Close
I haven't tested it but it should work, I'm not at my developing PC right now.
B4X:
Cursor = SQL1.ExecQuery("SELECT id, titolo, traccia, corpo FROM tb_temi WHERE id='" & n & "'")
If Cursor.RowCount = 0 then
MsgBox("Nothing Found", "")
Else
Traccia = Cursor.GetString("traccia")
Corpo = Cursor.GetString("corpo")
Titolo = Cursor.GetString("titolo")
Msgbox ("Traccia: " & traccia & CRLF & CRLF & corpo, titolo)
End If