How to identify Index fields in TMSTable Compact Edition

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
otomazeli
Posts: 10
Joined: Mon 22 Feb 2010 18:32

How to identify Index fields in TMSTable Compact Edition

Post by otomazeli » Mon 22 Feb 2010 18:39

I've test the code:
for i := 0 to TBl.FieldCount-1 do
begin
bIsKey := TBl.GetFieldDesc(TBl.Fields.FieldName).IsKey;
if bIsKey then
Showmessage('is key');
end;

But it seems that is not working in compact edition because I'm receiving false for all fields.

Any suggestions?

=================================================
>Hello,

>1. SDAC doesn't support IndexDefs, but you can use the >TMSTable.OrderFields property to build ORDER BY clause of SQL >statement.

>2. You can learn if the field is primary key using the TFieldDesc.IsKey >property. Also you can use the TMSMetadata component to obtain >metainformation about database objects from the server, including >information about primary key.

>Best regards,
>Devart Team
>www.devart.com



>Request Category: Technical
>Product: SQL Server Data Access Components
>Product Version: 4.80.054
>OS Version: Windows XP
>Platform: x32


>Details:

>Hi I'm testing your components to validate if we are going to to >change to SDAC. But I'm having dificulties related to TMSTable I don't >find the IndexDef as used on TTable and there is no way to get the >primary key index field names. Is there a way to do that?

>Thanks in advance.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 23 Feb 2010 11:03

You should open a table before getting information about fields.

otomazeli
Posts: 10
Joined: Mon 22 Feb 2010 18:32

How to identify Index fields in TMSTable Compact Edition

Post by otomazeli » Thu 25 Feb 2010 18:07

Hello Dimitry,

I'm not comfortable with your answer!
Of course if I'm trying to access the field properties the table is already open and still doesn't work for compact edition.

Do you have and example showing it should be done? I'm using SDAC Professional Licensed.


Thanks in advance!

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 26 Feb 2010 08:41

The code you are using is correct. But you should execute the TBl.Open method before using it. If you go this way then I can not reproduce the problem.
Please send me an example of your database to reproduce the problem.

Post Reply