Convert TWideString to TString
Posted on 2006-11-20
I am trying to take the field column name data from an ADO Query and put the column names into a listbox. Prior to the latest release of Delphi this was easy, but now they save the field names as TWideString and everything I have tried I either get index out of bounds or incompatible types TWideString and TStrings. Does anyone know how to copy the data from the query to a listbox easily??
Here are some of the things I have tried:
1. ListBoxSelect.Items.AddStrings(FDB.ADOQuerySalesman.FieldList); - incompatible - TStringList and TFieldList
2. FDB.ADOQuerySalesman.GetFieldNames(tempList); - deprecated
3. for I := 1 to FDB.ADOQuerySalesman.FieldCount do
ListBoxSelect.Items.AddStrings(FDB.ADOQuerySalesman.FieldList.Strings[i]); - incompatible - TStrings and TWideString
4. for i:=1 to FDB.ADOQuerySalesman.FieldCount do
ListBoxSelect.Items.Add(FDB.ADOQuerySalesman.FieldList.Strings[i]); - index out of bounds
I need an answer soon, I have a project due date coming up and have more work to do once I figure this out!
Thanks for any help