Add indexes in ASP

Results 1 to 2 of 2

Thread: Add indexes in ASP

  1. #1
    Join Date
    Dec 1969

    Default Add indexes in ASP

    How would I add indexes to an access 97 db via ASP? I would like first to test to see if a field is indexed, and if not to create a new index for it.<BR><BR>Please let me know if this is possible (and where I can find info on how to do it). Even if it is not possible, please let me know and I will try some other way.<BR><BR>Thanks<BR>James

  2. #2
    Richard A. Lowe Guest

    Default ADOX

    Should be possible: <BR><BR>You need to use ADODB&#039s cousin, ADOX. Check to see if you have the ADO help file on your machine: should be adoXXX.chm where the XXX is the version number of ado. If you have the ADO260.chm help file, it has a great section on ADOX.<BR><BR>But in a nutshell, you need to instantiate an ADOX.Catalog object, which contains a Tables collection. Each table object has an Indexes collection. The indexes collection allows you to Append an new index.<BR><BR>Something like this:<BR><BR>&#039 objConn is an already open ADODB.Connection obj:<BR><BR>Set objCat = Server.CreateObject("ADODB.Catalog")<BR>Set objCat.ActiveConnection = objConn<BR><BR>objCat.Tables("MyTable").Indexes.Ap pend "MyIndexName", "Column1", "Column2"<BR><BR>Richard

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts