Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to 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)?
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 29-Jun-12 1:05am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

// 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;
  Permalink  

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



Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 27 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100