[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

Find keyfield in a DataTable

How can find out, if field in a DataTable is a keyfield ?
0
ICSAutomation
Asked:
ICSAutomation
  • 2
1 Solution
 
anyoneisCommented:
Examine the Constraints collection on the table.

David
0
 
rameedevCommented:
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
 
anyoneisCommented:
Is my response not correct? It is how I would do it.

David
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now