Click here to Skip to main content
11,639,178 members (65,583 online)
Rate this: bad
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)?
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 0:05am

1 solution

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

Solution 1

// fields before you call
procedure TForm1.buttonGetFieldsClick(Sender: TObject);
  ADOConnection1.GetFieldNames(editTable.Text, memoTableFields.Lines);
// after editing you can set memo list
procedure TForm1.buttonSetFieldsClick(Sender: TObject);
  listboxFields.Items := memoTableFields.Lines;

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

  Print Answers RSS
0 Suvendu Shekhar Giri 280
1 Sergey Alexandrovich Kryukov 279
2 Richard Deeming 200
3 CPallini 187
4 PIEBALDconsult 175
0 OriginalGriff 9,081
1 Sergey Alexandrovich Kryukov 8,812
2 Mika Wendelius 7,027
3 Suvendu Shekhar Giri 2,600
4 F-ES Sitecore 2,548

Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 27 Aug 2012
Copyright © CodeProject, 1999-2015
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