PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
DataRelations. With or without the constraint?
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
DataRelations. With or without the constraint?
![]() |
DataRelations. With or without the constraint? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Why would you be able to (or want to), create a DataRelation without a
constraint? The DataRelation constructor takes a parent and child column array to create the association, I assume (maybe incorrectly) that the child column array would serve as the Foriegn Key. However, you need to set the last parameter to TRUE to create the constraint in the child table. When would you create a DataRelation without a FK constraint? In SQL Server, can you create a DataRelation without a constraint? -- Michael Hockstein |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Hi Michael,
In SQL Server, the relation and contraint are created together. Because a database requires integrality. All data that goes into it must be valid. However, the DataSet is not so strict. Sometimes people just need a relation for them to find child rows. There can be some data whose value does not follow the contraint, which means the constraint are not enforced. This is a requirement for some apps, so the DataSet class must be flexible enough to meet all the requirements. If anything is unclear, please feel free to let me know. Kevin Yu Microsoft Online Community Support ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscript...ault.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscript...rt/default.aspx. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Thanks for your help. I guess that the DataRelation is sort of like putting 2
tables into a query designer and dragging a relation between tables. No constraints there. Just the relation. Adding the Constraint to the DataRelation is more akin to what occurs in SQL Server when you create a relation with a FK constraint. So, if I really only need the relation to retreive child rows, I don't need the constraint created. If though I need child rows updated/deleted based on what I due to a parent row, or if I need the sure that there are no orphan child rows then I need the constraint. Thanks -- Michael Hockstein "Kevin Yu [MSFT]" wrote: > Hi Michael, > > In SQL Server, the relation and contraint are created together. Because a > database requires integrality. All data that goes into it must be valid. > > However, the DataSet is not so strict. Sometimes people just need a > relation for them to find child rows. There can be some data whose value > does not follow the contraint, which means the constraint are not enforced. > This is a requirement for some apps, so the DataSet class must be flexible > enough to meet all the requirements. > > If anything is unclear, please feel free to let me know. > > Kevin Yu > Microsoft Online Community Support > > ================================================== > Get notification to my posts through email? Please refer to > http://msdn.microsoft.com/subscript...ault.aspx#notif > ications. > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues > where an initial response from the community or a Microsoft Support > Engineer within 1 business day is acceptable. Please note that each follow > up response may take approximately 2 business days as the support > professional working with you may need further investigation to reach the > most efficient resolution. The offering is not appropriate for situations > that require urgent, real-time or phone-based interactions or complex > project analysis and dump analysis issues. Issues of this nature are best > handled working with a dedicated Microsoft Support Engineer by contacting > Microsoft Customer Support Services (CSS) at > http://msdn.microsoft.com/subscript...rt/default.aspx. > ================================================== > > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
Hi Michael,
You can select what to create. Relation Only, FK constraint Only, or both. Here are the steps: 1. Right click on the relation line in the DataSet designer and select Properties from the context menu. 2. In the dialog box, you can choose what to create with the radio buttons. Please try it and let me know the results. Thanks! Kevin Yu Microsoft Online Community Support ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

