Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7935803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:02:01+00:00 2026-06-03T22:02:01+00:00

For an application written in C# using an Access database via a JET OLEDB

  • 0

For an application written in C# using an Access database via a JET OLEDB connection:

I am writing an interface that allows the user to edit the values of tables containing keywords (there are several tables involved, I’m trying to do it generically).

The tables contain several columns. Some columns have a “no duplicates” constraint, some do not. I need to be able to tell which columns have the “no duplicates” constraint so I can check the entries as a whole prior to writing them to the table, to avoid violating the “no duplicates” constraint. (I know I can catch the error when writing but I’d really prefer not to go there.)

How do I determine what columns in a table in an Access database have a unique (no duplicates) constraint?

Thank you

-Zhi

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:02:02+00:00Added an answer on June 3, 2026 at 10:02 pm

    You can check the index schema for True in the Unique column. Some very rough notes:

    //http://msdn.microsoft.com/en-us/library/ms135981.aspx
        //Or Microsoft.Jet.OLEDB.4.0
    OleDbConnection cn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; "
       + "Data Source=" + pathToAccessDb);
    cn.Open();
    
    //Retrieve schema information
    DataTable columns = cn.GetOleDbSchemaTable(OleDbSchemaGuid.Indexes,
                 new Object[] { null, null, null, null, "Table1" });
    
    foreach (DataRow row in columns.Rows)
    {
       Console.WriteLine(row["COLUMN_NAME"].ToString());
       Console.WriteLine(row["TABLE_NAME"].ToString());
       Console.WriteLine(row["UNIQUE"].ToString());
    }
    
    cn.Close();
    
    //Pause
    Console.ReadLine();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Windows application written in C# that works with an Access database
I have written a C# application that connects to an Oracle 10g database. Using
I have an application written using the M-V-VM approach. The data access is done
A legacy web application written using PHP and utilizing MySql database needs to be
I am writing a client-server application using TCP Sockets. The server is written in
We have a windows MFC app that is written against an access database on
I have written a database application using a binary file as storage. it is
A new client of mine has a small VB/Access database application written in 2002
I am writing a web application and have just implemented that a user can
I've recently started working with an application written using Adobe Flex 3. We're using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.