开发者

Relations between tables

I have two tables (picture), AirportIn is a foreign key of AirportID, and AirportOut is also a foreign key of AirportID.

Relations between tables

开发者_运维百科

The problem is I can't make relations between these tables like this:

dataset.Relations.Add("AirportFlight", dataset.Tables["Airport"].Columns["AirportID"], dataset.Tables["Flight"].Columns["AirportIn"]);
dataset.Relations.Add("AirportFlight", dataset.Tables["Airport"].Columns["AirportID"], dataset.Tables["Flight"].Columns["AirportOut"]);

In runtime I get an error. How to solve the problem ?


Give the 2 relations unique names.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜