I’m working with an SQLite database in which I add each element in the table to a List.
The data is in the database and confirmed by debug statements along with DB browser for SQLite confirms the data is in there.
When I add each item to the list, only the first one is added. The count no matter what is 1.
I thought it might be a coding problem, so I brought in a function that does the exact same thing in a different program(which I know works), changed everything to match and STILL, the count is 1.
Any idea why this might happen?
Any idea how it can be fixed?
Thanks all!
public void LoadVitals()
{
Debug.Log("Load Vitals!");
Vitals.Clear();
mConnection.Open();
mSQLString = "SELECT * FROM " + SQL_TABLE_VITALS;
mCommand.CommandText = mSQLString;
mCommand.ExecuteNonQuery();
mReader = mCommand.ExecuteReader();
while (mReader.Read())
{
Vitals.Add(new Vitals(mReader.GetInt32(0),
mReader.GetInt32(1),
mReader.GetFloat(2)));
Debug.Log(mReader.GetInt32(0) +
mReader.GetInt32(1) +
mReader.GetFloat(2));
}
mReader.Close();
Debug.Log("How many in Vitals?" +Vitals.Count);
}