dhawks
asked on
D5 ADOTable.IndexName problem with MSAccess 2000
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?
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?
what version of MDAC do you have ?
make sure the TADOTable is closed while changing the index
set the Active property of TADOTable to false
ASKER
how would I find the version of MDAC?
the best way to find out the MDAC version is to use this tool:
http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&displaylang=en
http://www.microsoft.com/downloads/details.aspx?FamilyID=8f0a8df6-4a21-4b43-bf53-14332ef092c9&displaylang=en
did you set the Active property of TADOTable to False?
as for the problem...
did you set the
ADOConnection.CursorLocati on to clUseServer and
ADOTable.TableDirect = True
?
did you set the
ADOConnection.CursorLocati
ADOTable.TableDirect = True
?
ASKER
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
MDAC is version 2.81.1117
ASKER
If I set the IndexFieldNames directly, it seems to work... why won't it use the FieldNames from the MSAccess Index?
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.
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.
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
set TableDirect property to True. this way the recordset will be ordered by the fields in the index. No need to use IndexFieldNames.
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
to obtain the fields which compose the index use something like:
ADOTable1.IndexDefs[1].Fie lds
ADOTable1.IndexDefs[1].Fie
ASKER
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!
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!
there is no negative effect, the setting is by default set to False because not all providers support accessing a table by its name.
>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)
it has nothing to do with indexes, but it will sort your table by that field(s)
ASKER
Provider=Microsoft.Jet.OLE