Question, data show a record of sqlite

marbellapc

Member
Licensed User
Longtime User
The problem is that I have created in sqlite3 db, works well in the ListView shows me the records with the product name, but when I click on a record, I always display them last data record in the list when I click on the ListView.
Code: Copy
Sub ListView1_ItemClick (Position As Int, Value As Object)
   RemoveViews
   Activity.LoadLayout("Product")
   ItemSelected = Value
   
   Label_Titulo.Text         = Cur.GetString("Titulo")
   Label_Fecha.Text          = Cur.GetString("Fecha")
   ImageView_Foto.Bitmap     = LoadBitmap(File.DirAssets, Cur.GetString("Imagen")) ' Pruebas de imagen
   Label_Producto.Text       = Cur.GetString("Producto")
   Label_Localidad.Text      = Cur.GetString("Localidad")

    End Sub
I changed several times how to do the query but without success, keeps giving the data of the last record of the list of ListView.
Code: Copy
Sub ListView1_ItemClick (Position As Int, Value As Object)
   RemoveViews
   Activity.LoadLayout("Product")
   ItemSelected = Value

    Cur = SQL1.ExecQuery("SELECT Titulo, Imagen, Localidad, Producto, Fecha, Ingredientes, Proceso FROM Countries")
 For i = 0 To Cur.RowCount - 1
    Cur.Position = i
   Label_Titulo.Text         = Cur.GetString("Titulo")
    Label_Fecha.Text         = Cur.GetString("Fecha")
   ImageView_Foto.Bitmap     = LoadBitmap(File.DirAssets, Cur.GetString("Imagen"))
   Label_Producto.Text       = Cur.GetString("Producto")
   Label_Localidad.Text      = Cur.GetString("Localidad")
 Next
'    Cur.Close
End Sub
I have relied on the example of jpvniekerk, but can not get the labels show the data for the record down.
http://www.b4x.com/forum/basic4andr...arebones-view-examples-sqlite.html#post120915

I hope you can help me out and guide me in what I'm doing wrong.

Greetings and thanks in advance
 

Attachments

You should try to do it on your own.
Reading the two tutorials I mentioned in a previous post and trying to transpose them to your project.
You may also look in the Beginner'sGuide.
That's the best way to learn and get experience.
If I write the program for you, you would get a solution but no experience.
Then if you have problems we will help you.
 
Upvote 0
Back
Top