Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Retrieving tables from list with SQLiteOpenHelper

Hi,
I’m working on an SQLite database GUI using SQLiteOpenHelper, and I’m trying to have it so that the user can access the list of tables that they have created. I have already figured out how to show the tables that were and are created in a list, but I still need to find away so that the selected list item points to and refers to its corresponding table. Right now, I have it so that it will return the lastly created table and its info, but I instead need it to return the table info from whichever table was just pressed. Any ideas or suggestions on how to go about this? Please don’t hesitate to let me know if you need further information or code.
Thanks!

Best Answer

Answers

  • jezhjezh Member, Xamarin Team Xamurai
    edited November 2020

    but I still need to find away so that the selected list item points to and refers to its corresponding table. Right now, I have it so that it will return the lastly created table and its info, but I instead need it to return the table info from whichever table was just pressed.

    You can first know the table name of the selected list item, then according to the table name, you can query this table by the SQLiteOpenHelper.

  • AkelahAkelah Member ✭✭

    You can first know the table name of the selected list item, then according to the table name, you can query this table by the SQLiteOpenHelper.

    It seems so, but I still don't know how. How can I query the table by the selected item? I can't quite get the name of the item from where I want to do it, which would be in the click event for the list item. The only thing I can think know is getting the position of the item, and then passing that somehow to the DBHelper. Also, I would need the columns name as well, at least I would for the method of retrieval I'm using.

  • AkelahAkelah Member ✭✭

    @jezh Thanks for your suggestion! It works when I save the value as a preference, and I pass it through the SQLiteOpenHelper class and get the associated columns with it.

  • jezhjezh Member, Xamarin Team Xamurai

    Congrats, thanks for your support for xamarin.

    Have a nice day. :)

Sign In or Register to comment.