Add Indexed (Duplicated OK) to access database C#

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Chintan Shah
    New Member
    • Jan 2011
    • 6

    Add Indexed (Duplicated OK) to access database C#

    I have an application which inserts large amount of data in Access database. So to speed up the things i have set Indexed property to No.

    So at the end of insertion i need to set the index to the column of the one of the table to Indexed (Duplicates OK) through C#.

    Help would be really appreciated.

    Thanks
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    I don't know how you got rid of the index since you didn't post your code but you can probably just reverse whatever code you used to get rid of it.

    Comment

    • Chintan Shah
      New Member
      • Jan 2011
      • 6

      #3
      Actually i removed directly from xxx.accdb access file.
      I just want to add index through code to make reading faster.

      I tried:

      Code:
      string addIndex = "CREATE INDEX columnName ON table(columnName) WITH IGNORE NULL";
      OleDbCommand cmd = new OleDbCommand(addIndex, conn);
      cmd.ExecuteNonQuery();
      but it didn't work.
      Last edited by Rabbit; Jan 31 '13, 10:27 PM. Reason: Please use code tags when posting code.

      Comment

      • Chintan Shah
        New Member
        • Jan 2011
        • 6

        #4
        Actually worked .. changed the index name different then column name.

        Thanks

        Comment

        Working...