Access closed Cursor Error

junaidahmed

Well-Known Member
Licensed User
Longtime User
When i run sqlite application it shows an error "Android.Database.StaleDataException : Access closed Cursor"

Pls advise where it is problem
 

junaidahmed

Well-Known Member
Licensed User
Longtime User
See the Below code and advise where it is problem

For i = 0 To ExpenseManager.RstTmp.RowCount - 1
ExpenseManager.RstTmp.Position = i
DoEvents
If ExpenseManager.RstTmp.GetString("TrDate") <> Null Then
AddRow(Array As String(ExpenseManager.RstTmp.GetString("TrDate"), ExpenseManager.RstTmp.GetString("Amount")),2)
Else
Msgbox("There is No Record","ExpenseHistory")
End If
Next
ExpenseManager.RstTmp.Close
 
Upvote 0

junaidahmed

Well-Known Member
Licensed User
Longtime User
See the below AddRow Sub

Sub AddRow(Values() As String, NumberOfColumns As Int)

Dim lastRow As Int
lastRow = Table.NumberOfViews / NumberOfColumns
For i = 0 To NumberOfColumns - 1
Dim l As Label
l.Initialize("cell")
If Values(i) <> Null Then
If IsNumber(Values(i)) Then
l.Text = NumberFormat(Values(i),0,2)
l.TextColor = Colors.Red
Else
l.Text = Values(i)
l.TextColor = FontColor2
End If
End If
l.Gravity = Alignment
l.TextSize = FontSize
l.Color=Colors.White
Dim rc As RowCol
rc.Initialize
rc.Col = i
rc.Row = lastRow
l.Tag = rc
Table.AddView(l, ColumnWidth * i, RowHeight * lastRow, ColumnWidth_1, RowHeight_1)
Next
Table.Height = (Table.NumberOfViews / NumberOfColumns) * RowHeight

End Sub
 
Upvote 0

junaidahmed

Well-Known Member
Licensed User
Longtime User
Acutally,In my project there two button Next and Previous,When I Press Next and Previous button it Shows SQLite Record in Grid (Tableview) by looping AddRow Method. The reason for error "Access Closed Cursor" is When I Press Next / Prev button Continously ,the loop does not complete and SQLite Through an error as "Access Closed Cursor" .So I just put "ProgressDialogShow2("Please wait !............. ",True)" between the loop,so that we can not do any action between this looping.

This is my simple Thoughts,

Once again I am sorry to all because of disturbance.
But one thing is I have learn so many thing in this forum with yours help.

Thanks Regards

Junaid Ahmed
 
Upvote 0
Top