F
FcabralJ
Guest
Currently I'm very beginner in c# and I don't understand how can I get a data from DB (let's say using data table) and transform it into a object class.
For example:
public class Car
{
public string Name { get; set; }
public string Brand { get; set; }
}
public class DataProccess
{
var _dataTable = new DataTable(psfTable);
var _dataAdapter = new DataAdapter("Select * FROM cars",_conn);
_dataAdapter.Fill(_dataTable);
}
How can I map the datatable to the class without mapping each one of the fields? What is the right way to do it?
Continue reading...
For example:
public class Car
{
public string Name { get; set; }
public string Brand { get; set; }
}
public class DataProccess
{
var _dataTable = new DataTable(psfTable);
var _dataAdapter = new DataAdapter("Select * FROM cars",_conn);
_dataAdapter.Fill(_dataTable);
}
How can I map the datatable to the class without mapping each one of the fields? What is the right way to do it?
Continue reading...