开发者

Asp.net :a problem with dataset and datarelations

In my asp.net web application i create a dataset with 3 tables (see image below) and 3 relations. The schema represent a car accident database with CarAccident table (IncidenteStradale), RoadUser table (UtenteStrada) and VehicleTable (Veicolo). The relation between UtenteStrada and IncidenteStradale need to keep track of pedestrian involved.

The problem is this : -if i set all relations with foreign key constraints (Update and Delete rule set to Cascade) when i add a new row to UtenteStrada (RoadUser) table with IdVeicolo (Vehicle id) unset (that means he is a pedestrian) on the tableadapter.Update method call i get an error due to foreign-key violation (because there's no vehicle associated). -If the relationship between UtenteStrada and Veicolo (Vehicle) tables is defined as "Relation Only" (without any foreign key constraint) when the tableadapter.Update method is called the foreign key on UtenteStrada table rows is not updated (so occupant of a given vehicle has no reference to开发者_运维技巧 the vehicle table).

How can i solve this situation?

Thanks.

Asp.net :a problem with dataset and datarelations

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜