Hello,
I have 2 tables, master, detail. 1.master table have fields (id, username, plan)-->id is primary key (PK) 2. detail table have fields (srNo,id, worksummary, ... )--> srNo is PK.
I have created foreign key relationship from detail to .master table for "id" field.
the code is:
IList<detail> objDetail=new List<detail> ();
IList<master> objMaster = new List<master> ();
string[] sarray = queryFields.Split('|');//
for (int i = 0; i < sarray.Length; i++)
{
string[] sfields = sarray[i].Split(',');
if (sfields[0] != "")
{
objDetail.Add(new _detail { Id = count , modify = sfields[1].ToString(), verified = sfields[2], I});
}
}
I have problem to add fields in "objDetail" using Add method. But I am unable to access the reference field "Id" , rest of the field of detail table can be accessed using objDetail.
How can I access the "Id" field from objDetail object to add in IList.
Update: Hi,
No, the queryField is not from database, it is just the hidden variable getting from the method parameter Count is integer variable in which I am assigning the value as the row number.
Type "detail" and " master " are the database tables. details type in line 1 is same as _detail (It was just spelling mistake). I am accessing the database using Entity frame work.
I am able to access all field of detail table but the field on which foreign key relation ship exist is not accessible.
How can I access that reference field.
thanks.