Solved

Find keyfield in a DataTable

Posted on 2006-11-23
4
213 Views
Last Modified: 2012-05-05
How can find out, if field in a DataTable is a keyfield ?
0
Comment
Question by:ICSAutomation
  • 2
4 Comments
 
LVL 11

Expert Comment

by:anyoneis
ID: 18004333
Examine the Constraints collection on the table.

David
0
 
LVL 5

Expert Comment

by:rameedev
ID: 18006469
What you could do is to check for  "Unique" property for a particular column..this returns a bool value..If true it tells you that all the values in the this column for all rows is unique.

something like this

bool isUnique = ds.Tables[0].Columns[0].Unique
0
 
LVL 11

Accepted Solution

by:
anyoneis earned 75 total points
ID: 18171556
Is my response not correct? It is how I would do it.

David
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to compare two table schema using c#? 6 32
.NET Error 7 42
What .NET website keeps me current? 9 31
C# TextBox 11 12
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now