Board index » delphi » Checking the existence of a column in a table

Checking the existence of a column in a table

I need to check if a column exists in a table.
 

Re:Checking the existence of a column in a table


How do I determine if a field exists in a table at runtime?
Use the following line in your application:

If (aTTable.FindField('SomeFieldName') = Nil) Then
  begin
    { field does not exist - do something here }
  end;

Vinnie Murdico
Software with Brains, Inc.
SWBTracker - Bug Tracking Software for Windows
http://www.softwarewithbrains.com

Re:Checking the existence of a column in a table


if Table1.FindField('TheField') = nil then
  ShowMessage('The field does not exist.');

--
Bill
(TeamB cannot answer questions received via email)

Other Threads