On 23 Jun 2006 00:29:03 -0700, "The Rock" <George@[EMAIL PROTECTED]
>
wrote:
>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
>
Try generating the sql string so it looks like this:
select C.leadid, C.field1, C.field6, C.field7, C.field8, C.field9,
C.field10
from campaignleads C
where leadid = 3639
>
I suspect IB is confusing field6 in this query with another field6 it
has created for something else.
HTH,
Dan
>I get an error: EDataBaseError with message: "A component named Field6
>already exists"
>
>Any ideas? Thanks in advance


|