Please help how can i check to see if the cursor is already closed am getting this error on my app
B4X:
autofield: 1
[{"Account":"05-00001","balance":-866926,"class":"S2","Stream":"A","Names":"BUGEMBE YASIN ismail","autofield":1},{"Account":"05-00005","balance":2010000,"class":"S5","Stream":"A","Names":"DDAMULIRA GEORGE","autofield":5},{"Account":"05-00013","balance":1910000,"class":"S5","Stream":"A","Names":"ASADU","autofield":13}]
Account: 05-00005
Amount: 2010000
Class: S5
Stream: A
Names: DDAMULIRA GEORGE
autofield: 5
[{"Account":"05-00001","balance":-866926,"class":"S2","Stream":"A","Names":"BUGEMBE YASIN ismail","autofield":1},{"Account":"05-00005","balance":2010000,"class":"S5","Stream":"A","Names":"DDAMULIRA GEORGE","autofield":5},{"Account":"05-00013","balance":1910000,"class":"S5","Stream":"A","Names":"ASADU","autofield":13}]
Account: 05-00013
Amount: 1910000
Class: S5
Stream: A
Names: ASADU
autofield: 13
Error occurred on line: 235 (Main)
java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/user/0/kccug.com/files/studentdbmk.sql
at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1314)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1257)
at anywheresoftware.b4a.sql.SQL.ExecQuery2(SQL.java:223)
at anywheresoftware.b4a.sql.SQL.ExecQuery(SQL.java:211)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
B4X:
Sub ExecuteHtml(SQL As SQL, Query As String, StringArgs() As String, Limit As Int, Clickable As Boolean) As String
'adjust by sula
Private cur As Cursor
If StringArgs <> Null Then
cur = Starter.SQL1.ExecQuery2(Query, StringArgs)
Else
cur = Starter.SQL1.ExecQuery(Query)
End If
Log("ExecuteHtml: " & Query)
If Limit > 0 Then Limit = Min(Limit, cur.RowCount) Else Limit = cur.RowCount
Private sb As StringBuilder
sb.Initialize
sb.Append("<html><body>").Append(CRLF)
sb.Append("<style type='text/css'>").Append(HtmlCSS).Append("</style>").Append(CRLF)
sb.Append("<table><tr>").Append(CRLF)
For i = 0 To cur.ColumnCount - 1
sb.Append("<th>").Append(cur.GetColumnName(i)).Append("</th>")
Next
sb.Append("</tr>").Append(CRLF)
For row = 0 To Limit - 1
cur.Position = row
If row Mod 2 = 0 Then
sb.Append("<tr>")
Else
sb.Append("<tr class='odd'>")
End If
For i = 0 To cur.ColumnCount - 1
sb.Append("<td>")
If Clickable Then
sb.Append("<a href='http://").Append(i).Append(".")
sb.Append(row)
' sb.Append(".com'>").Append(cur.GetString2(i)).Append("</a>")
sb.Append(".stub'>").Append(cur.GetString2(i)).Append("</a>")
Else
sb.Append(cur.GetString2(i))
End If
sb.Append("</td>")
Next
sb.Append("</tr>").Append(CRLF)
Next
cur.Close
sb.Append("</table></body></html>")
Return sb.ToString
End Sub