Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Delphi
ADOConnection1.GetFieldNames('Employee', ListBox1.Items);

Above is the code that is shown that should be used when calling this method. If I try the code below, an error message comes up in the very next line of code, always.

Is there any way to replace the ListBox.Items with a StringList (which can be changed etc before placing this StringList into the ListBox)?
Delphi
var
TablesList : TStringList;
//...
ADOConnection1.GetFieldNames('Employee', TablesList);
//code to modify the TablesList as I want to... then display the list in the listbox
ListBox1.Items := TablesList;


I need to modify the list returned from the GetFieldNames method before it may be displayed to the user... How else can this be done?
Posted

1 solution

Delphi
// fields before you call
procedure TForm1.buttonGetFieldsClick(Sender: TObject);
begin
  memoTableFields.Clear;
  ADOConnection1.GetFieldNames(editTable.Text, memoTableFields.Lines);
end;

// after editing you can set memo list
procedure TForm1.buttonSetFieldsClick(Sender: TObject);
begin
  listboxFields.Clear;
  listboxFields.Items := memoTableFields.Lines;
end;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900