Hi - If anyone can assist it would be great
I am generating a quick re****t (In Delphi 7) (although this same error
occurs on a normal form as well). I have 4 TQuery components used to
extract data from an Interbase 6.0 database. One of my tables holds
"dynamic field information" (e.g. the column names are field1, field2,
field3, field4 etc.)
I create a select query string after the user has selected (in a
checklistbox) which fields (field1, field2, field3 etc.) he would like
to view in the re****t. The field selection is kept in a TStringList
(FieldList) and then added to the query sql statement.
qry3.Active := false;
qry3.SQL.Clear;
qry3.SQL.Add('select leadid,' +
frmUserLeadStatusRptFilter.FieldList.CommaText);
qry3.SQL.Add('from campaignleads');
qry3.SQL.Add('where leadid = ' + qry2.fieldbyname('leadid').asstring);
qry3.Active := true;
Interestingly, when the user selects all the fields to display I do not
get the error: (it would look like this)
select
leadid,field1,field2,field3,field4,field5,field6,field7,field8,field9,field10,field11,field12,field13
from campaignleads
where leadid = 4130
BUT when the user selects random fields (it would look like this)
select leadid,field1,field6,field7,field8,field9,field10
from campaignleads
where leadid = 3639
I get an error: EDataBaseError with message: "A component named Field6
already exists"
Any ideas? Thanks in advance


|