Solved

Find keyfield in a DataTable

Posted on 2006-11-23
4
216 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

777 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