How to add a field programatically to a TAdoTable in Delphi

后端 未结 6 782
无人及你
无人及你 2021-01-16 10:48

In my Delphi 2009 application I need to check if a field exists and if it doesn\'t add it during application execution.

I have figured out the test for the field,

6条回答
  •  情歌与酒
    2021-01-16 11:32

    You can create new field using SQL. In my opinion is the best chance. If you don't want use SQL you can see this article for create new fields with ADO using ADOX (originaly in Spanish but at right you can translate the page) "Create fields in a table (Access) Code, using ADOX" original/translated

    If must know the field in a table you can access the TADOTable and the method GetFiledDef. Additionaly the method FindField return nil if the field dot not exist.

    Additionally some Databases/SGBD's have system tables that you can access with an SQL for know Existent Tables,Fields,Indexes,...

    Excuse for my bad english.

    Regards.

提交回复
热议问题