Solved

D5 ADOTable.IndexName problem with MSAccess 2000

Posted on 2004-09-14
19
1,028 Views
Last Modified: 2012-05-05
Delphi 5 Enterprise

I am currently connecting to a MSAccess 2000 table using TADOTable. The table data shows up in my DBGrid, but when I try to set the "IndexName" property of TADOTable, I get an EOLEException with the message "Current provider does not support the necessary interface for Index functionality." In the Object Inspector, all of the Index names show up in the drop-down list for the "IndexName" property. If I try to set the property at design time, I get the same error message.

Any ideas?
0
Comment
Question by:dhawks
  • 8
  • 6
  • 5
19 Comments
 

Author Comment

by:dhawks
ID: 12059860
I forgot the connection string I'm using for my ADOConnection


Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Projects\Database\Test.mdb;Mode=Share Deny None;Extended Properties="";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False
0
 
LVL 6

Expert Comment

by:bpana
ID: 12059973
what version of MDAC do you have ?
0
 
LVL 6

Expert Comment

by:bpana
ID: 12060022
make sure the TADOTable is closed while changing the index
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 6

Expert Comment

by:bpana
ID: 12060047
set the Active property of TADOTable to false
0
 

Author Comment

by:dhawks
ID: 12060145
how would I find the version of MDAC?
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12060193
0
 
LVL 6

Expert Comment

by:bpana
ID: 12060270
did you set the Active property of TADOTable to False?
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12060272
as for the problem...
did you set the

ADOConnection.CursorLocation to clUseServer and
ADOTable.TableDirect = True

?
0
 

Author Comment

by:dhawks
ID: 12060280
Setting the Active property to false lets me assign IndexName, but it isn't setting IndexFieldNames for whatever reason.

MDAC is version 2.81.1117
0
 

Author Comment

by:dhawks
ID: 12060301
If I set the IndexFieldNames directly, it seems to work... why won't it use the FieldNames from the MSAccess Index?
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12060330
from the Delphi help:

Use IndexFieldNames as an alternative method of specifying the index to use for a table. In IndexFieldNames specify the name of each column to use as an index for a table. Ordering of column names is significant. Separate names with semicolon. There need not be an index in existence based on the specified columns.
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12060345
basically you can specify the IndexFieldNames and Delphi will sort it by that field(s) even if there is not an Index associated with that column, but it will be slow if there's no index
0
 
LVL 6

Expert Comment

by:bpana
ID: 12060383
set TableDirect property to True. this way the recordset will be ordered by the fields in the index. No need to use IndexFieldNames.
0
 

Author Comment

by:dhawks
ID: 12060388
If I set IndexName, nothing happens with the sorting of the records.

If I set IndexFieldNames, the records are sorted accordingly, but the IndexName property does not change.

I can set IndexFieldNames without setting Table.Active = False, but I must in order to set IndexName.

I still don't understand why the IndexFieldNames property is not being updated accordingly when I set IndexName.
0
 
LVL 6

Accepted Solution

by:
bpana earned 250 total points
ID: 12060393
IndexFieldNames has nothing to do with the indexes on the table.

just set TableDirect to True
0
 
LVL 6

Expert Comment

by:bpana
ID: 12060398
to obtain the fields which compose the index use something like:
ADOTable1.IndexDefs[1].Fields
0
 

Author Comment

by:dhawks
ID: 12060408
Setting TableDirect seems to have solved my problem.

Can you tell me what affect setting this property is going to have? Is there anything I should know that might affect other parts of my program?

Thanks!
0
 
LVL 6

Expert Comment

by:bpana
ID: 12060420
there is no negative effect, the setting is by default set to False because not all providers support accessing a table by its name.
0
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 12066554
>IndexFieldNames has nothing to do with the indexes on the table.

it has nothing to do with indexes, but it will sort your table by that field(s)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert GUI app into console app for Win32 Env 5 98
creating threads in delphi 1 101
Delphi: ForceDirectory plain function 7 29
SUM 2 INTEGER ARRAYS INTO 1 10 100
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

785 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