what are the different between these two when handling large Sqlite database
01.
02.
Can any body help me to improve my code
01.
B4X:
Cursor1 = SQL1.ExecQuery("Select * from Invoice" )
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
Cursor2.SQL1.ExecQuery("Select * from Product where ProductID= " & Cursor1.GetString("ProductID"))
Cursor2.Position = 0
Cursor3 = SQL1.ExecQuery("Select * from PDARetailer where RetID = " & Cursor1.GetString("RetailerID") )
Cursor3.Position = 0
AddRow(Array As String(Cursor1.GetString("InvoiceID") , Cursor2.GetString("ProductName"), Cursor2.GetString("RetailerName")))
Next
End If
Cursor1.Close
Cursor2.Close
Cursor3.Close
02.
B4X:
Cursor1 = SQL1.ExecQuery("Select * from Invoice" )
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
Cursor2.SQL1.ExecQuery("Select * from Product where ProductID= " & Cursor1.GetString("ProductID"))
Cursor2.Position = 0
Cursor3 = SQL1.ExecQuery("Select * from PDARetailer where RetID = " & Cursor1.GetString("RetailerID") )
Cursor3.Position = 0
AddRow(Array As String(Cursor1.GetString("InvoiceID") , Cursor2.GetString("ProductName"), Cursor2.GetString("RetailerName")))
Cursor2.Close
Cursor3.Close
Next
End If
Cursor1.Close
Can any body help me to improve my code