Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread dbisam engine error #11949
Tue, Feb 13 2018 2:19 PMPermanent Link

Ronald

Hi,

If I use this sql in EWB server then I get the expected result (a TGrid is filled):

select *
from test
where No='M030520171643050545494962825252'

But if I use parameters like this, I get an error:

select *
from test
where {No=M030520171643050545494962825252}

dbisam engine error #11949 parsing error expected column name but instead found 030520171643050545494962825252 in sql select statement

What am I doing wrong here?

Ronald
Tue, Feb 13 2018 3:48 PMPermanent Link

Richard Harding

Wise Nutrition Coaching

Hi Ronald

The "masterdetail" application in the example programs shows how to use parameters to obtain the orders for the selected customer.

* Using the Database Manager, select the ExampleData database and CustomerOrders dataset.
* The Select statement is defined as SELECT * FROM custord WHERE CustomerID={CustomerID}
* The parameter CustomerID is defined by {CustomerID}
* Ensure that the Base Table is defined which must contain a primary key.

In the application, set the parameters. For example,

procedure TMasterDetailDatabase.LoadCustomerOrders;
begin
  CustomerOrders.Params.Clear;
  CustomerOrders.Params.Add('CustomerID='''+Customers.Columns['CustomerID'].AsString+'''');
  LoadRows(CustomerOrders);
end;

Richard
Wed, Feb 14 2018 3:00 AMPermanent Link

Ronald

Richard Harding wrote:

> The Select statement is defined as SELECT * FROM custord WHERE CustomerID={CustomerID}
>* The parameter CustomerID is defined by {CustomerID}
>* Ensure that the Base Table is defined which must contain a primary key.

>CustomerOrders.Params.Add('CustomerID='''+Customers.Columns['CustomerID'].AsString+'''');


Hi Richard,

Thanks, I misunderstood the {} part, it works fine now. I only changed

CustomerOrders.Params.Add('CustomerID='''+Customers.Columns['CustomerID'].AsString+'''');

in

CustomerOrders.Params.Add('CustomerID='+QuotedStr(Customers.Columns['CustomerID'].AsString));
Image