SQLite in vb display all rows.


New member
Feb 1, 2023
Programming Experience
I am doing a school preoject and have looked into a lot of things but cannot seem to find a way to display all rows of a database. i have been using .ExecuteScalar but it will only display the first result. I cannot post my code in case i am accused of copying as this is an important project for me. Any help is welcome.
ExecuteScalar is specifically for returning a single value. If you want multiple columns and/or rows then that's useless.

The best way to retrieve the data depends on exactly how you want to display it. You can call ExecuteReader to get a data reader and then read the data row by row and column by column. More likely though, you'll want to populate a DataTable and display data from that, e.g. by binding it to a DataGridView. In that case, create the DataTable and call its Load method to load the data reader into it.

If you will want to edit the data and save the changes then you should use a data adapter instead. It's Fill method will populate a DataTable and its Update method will save the changes.