Subject | Re: [IBO] Cannot Prepare a blank statement error |
---|---|
Author | Helen Borrie |
Post date | 2009-03-07T20:42:59Z |
At 07:16 AM 7/03/2009, you wrote:
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
>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