Welcome to WebmasterWorld Guest from

Forum Moderators: open

MYSQL table to C# list

4:36 pm on Nov 4, 2017 (gmt 0)

Junior Member

5+ Year Member

joined:Oct 19, 2011
posts: 174
votes: 1

I'm migrating my program from using a local SQLIte database to an online MYSQL database in C#. To do so, I need to use a list to grab the information from a table, but I'm not sure how to do it for MYSQL.

Here is one of the functions I used for the SQLite version:
public List<CarInfo> MakeCarInfoList()
_connection = new SqliteConnection(_sqlDBLocation);
_command = _connection.CreateCommand();
_sqlString = "SELECT * FROM " + SQL_TABLE_CAR;
_command.CommandText = _sqlString;
_reader = _command.ExecuteReader();

while (_reader.Read())
CarInfoList.Add(new CarInfo(_reader.GetString(0),



return CarInfoList;

Could someone walk me through? Thanks!