var
c : OleVariant;
t : OleVariant;
i : Integer;
j : Integer;
begin
c := CreateOleObject('ADOX.Catalog');
c.ActiveConnection := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:/My Documents/db1.mdb';
t := c.Tables['t1'];//表名
for i := 0 to t.Keys.Count - 1 do
if t.Keys.item.type = 1 then
for j := 0 to t.Keys.Item.Columns.Count - 1 do
mem.Lines.Add(t.Keys.Item.Columns.Item[j].Name);//主键字段,如果是联合主键,会有多个
end;