I've created the table and put several rows into it. Is there a way to parse my own objects from table?
class Human
{
string name;
int age;
public Human(string name, int age)
{
this.name = name;
this.age = age;
}
}
string sql = "create table human (name varchar(20), age int)";
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();
string sql = "insert into human (name, age) values ('John', 20)";
command = new SQLiteCommand(sql, m_dbConnection);
command.ExecuteNonQuery();
string sql = "select * from human";
command = new SQLiteCommand(sql, m_dbConnection);
SQLiteDataReader reader = command.ExecuteReader();
command.ExecuteNonQuery();
while (reader.Read())
Parse Human from reader?
Aucun commentaire:
Enregistrer un commentaire