请参见 http://www.delphibbs.com/delphibbs/dispq.asp?lid=1296311
在delphi中Import type library,生成Adox_tlb.pas,引用它
procedure TForm1.Button1Click(Sender: TObject);
var cat:_Catalog;
tb1:_Table;
col1:_Column;
i:integer;
begin
cat:=coCatalog.Create;
cat.Set_ActiveConnection(self.ADOConnection1.ConnectionObject);
tb1:=coTable.create;
tb1.Name:='test';
cat.Tables.Append(tb1);
col1:=coColumn.Create;
col1.ParentCatalog:=cat;
col1.Name:='t2';
col1.Type_:= adinteger;
for i:=0 to col1.Properties.Count-1 do
begin
if Lowercase(col1.Properties.Item.Name) = 'autoincrement' then
col1.Properties.Item.Value:=true;
end;
tb1.Columns.Append(col1,col1.type_,col1.definedsize);
end;