Subject RE: [IBO] Cannot Prepare a blank statement error
Author Roger Vellacott
Helen,



I have never had any trouble assigning a string to the SQL.Text property
of any kind of dataset component, or indeed to any kind of string list.
SQL.Count seems to be completely reliable, even if the string contains
CRs. Lines can immediately be referred to by their line number, as
though the lines of the string had been entered using "Add".



Roger Vellacott

Passfield Data Systems Ltd

+44 (0) 1404 514402

+44 (0) 7831 156839





From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On
Behalf Of Helen Borrie
Sent: 07 March 2009 20:43
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] Cannot Prepare a blank statement error



At 07:16 AM 7/03/2009, you wrote:
>The error seems to come from IB_Components, TIB_BDataset.SysPrepareSQL
Procedure. It gets to the "if SQL.Count=0 then" statement and executes
the error message there.

The SQL property of a dataset is a stringlist, not a string. What's
happening at this point is that IBO checks whether the stringlist has
any strings: it finds none and so it throws the error.

When assigning to the dataset's SQL property at runtime, make sure you
use SQL.Add, not ':=' for the assignment, after calling SQL.Clear.

If, as Hans suggested, you are trying to assign to the SQL.Text
property, then don't. In practice, you should always regard the Text
property of a stringlist as read-only; although it can be safe to assign
to it from a TStringlist, like for example a TMemo.Lines object - as
long as you first check that the Lines object actually contains any
lines!

Helen





[Non-text portions of this message have been removed]