I am trying to load the values from a List<dataset> to List<Person>
I’ve written the following code, but am unsure what to do next
public List<Person> AddressFinderBLL_GetAddressbyName(String pfname,)
{
List<Person> Per= new List<Person>();
List<DataSet> lstPer = new List<DataSet>();
lstPer = Adal.AddressFinderDAL_GenerateDatabyName(
pfname, pfnameval, plname, plnameval);
//here List<Dataset> lstPer loaded with values from back end foreach(DataRow item in lstPer[0].Tables[0].Rows)
{
// here i need to assign the values to List<Person> from List<Dataset>[0].tables[0].rows;
}
Person class has following attributes class class Person
{
public String _firstname,_middlename;
public Person()
{
}
public String Firstname
{
get
{
return _firstname;
}
set
{
_firstname = value;
}
}
public String Middlename
{
get
{
return _middlename;
}
set
{
_middlename = value;
}
}
} please let me know
I don’t know what column names your DataSet has, but here’s an approximation:
Incidentally, a method returning a list of DataSets seems kind of unlikely. Are you sure that part’s right? Perhaps it returns one DataSet that contains multiple tables?