Questions That Should Be Asked More Frequently

Q

When should I create my DataRelation objects without constraints?

A

Let’s say that your application queries your database for customer and order data and displays that information on a simple Windows form. The application allows the user to view the data but not modify it.

In such an application, a DataRelation is useful because it lets you easily display the orders for a particular customer. However, you probably don’t want to use constraints within your DataSet. Why? Constraints are used to validate your data, and validating data takes time. If the data in the application is read-only and the database has already validated the data through its own set of constraints, there’s no need for ADO.NET to ...

Get Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.