Thanks for your interest.
What i am trying to say is I dont declare any DataRelation object at
design
time
and at runtime i have the instance of the DataSet , with these at hand ,
i
want to catch if one of the columns of datatable of the dataset is a
foreign
key of another table.
DSCities dc=new DSCities(); //the dataset for the CitiesTable
I'm afraid that I do not understand now...
Could you please explain again what you are trying to do?
foreach (DataColumn dc in dc.Tables[0]) {
//want to realize if the column is a FK...
}
best regards
emre
:
actually i think i was unable to clarify my problem,
the situation is the dataTable belongs to a single table and the
DataSet
class does not any
DataRelation object , what i am trying to do is to realize the foreign
key
relationship at runtime.
that is i can not utilize DataRelation property.
i think i need another option to realize that a column represents a
foreign
key
thanks in advance.
emre dincer
Try the sample you find here:
http://msdn2.microsoft.com/en-US/library/system.data.datatable.parentrelations.aspx
:
Dear All,
is it possible to extract the DataColumn which is a foreign key of
another
table.
foreach (DataRelation dr in dsIlce.Tables[0].ParentRelations) {
Console.WriteLine("123");
console.WriteLine(dr.ParentTable.TableName.ToString());
}
prints nothing unfortunately..
thanks in advance
emre dincer