Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 6 of 6 total
Thread Loadrows using Query
Sun, Apr 10 2016 11:05 PMPermanent Link

kamran

Hi All

Table query:
SELECT * FROM TranD WHERE tranh_id = {tranh_id = '0'}

EWB code:
TranID:=fCashier_M.WL_TranH.Columns['tranh_id'].AsString;
fCashier_M.WL_TranDFilter.Close;
fCashier_M.WL_TranDFilter.Params.Clear;
fCashier_M.WL_TranDFilter.Params.Add('tranh_id='+QuotedStr(TranID));
Database.LoadRows(fCashier_M.WL_TranDFilter);

It should pick up all the detail records that match the header key 'TranID'
There is a field defined call "tranh_id" in the header table and also in detail table.
So it should show all detail records that match TranID for the selected header.

It does not work .. Whats wrong here.?

Thanks

Kamran
Mon, Apr 11 2016 3:20 AMPermanent Link

Uli Becker

Kamran,

> SELECT * FROM TranD WHERE tranh_id = {tranh_id = '0'}
>...
> It does not work .. Whats wrong here.?

"It does not work" is not a good error description. What exactly happens
when you try to load the dataset?

Two ideas though:

1. Is tranh_id really a string or an integer? If it's an integer, your
syntax is wrong.

2. I remember that (at least in older versions) space-charactes where a
problem. Try to replace

SELECT * FROM TranD WHERE tranh_id = {tranh_id = '0'}

by

SELECT * FROM TranD WHERE tranh_id={tranh_id='0'}

Uli
Mon, Apr 11 2016 4:58 AMPermanent Link

kamran

1. tranh_id is a string (its defined as a Guid in edb table)

2. loadrows without params loads all data rows (Not What I want)  - so i know loading is working and showing in grid

3. I checked the query execution in the dataset manager and it works ok when i test with sample tranh_id value

so the problem must be in the loadrows section... i think..not sure

Uli wrote:
Two ideas though:

1. Is tranh_id really a string or an integer? If it's an integer, your
syntax is wrong.

2. I remember that (at least in older versions) space-charactes where a
problem. Try to replace

SELECT * FROM TranD WHERE tranh_id = {tranh_id = '0'}

by

SELECT * FROM TranD WHERE tranh_id={tranh_id='0'}

Uli
Mon, Apr 11 2016 5:20 AMPermanent Link

kamran

Hi Uli

Yes you were totally right.

Removing all the spaces in the dataset query definition as you described in 2 fixed it.

Many thanks for that.

Have a great day.

Kamran


Uli Becker wrote:

2. I remember that (at least in older versions) space-charactes where a
problem. Try to replace

SELECT * FROM TranD WHERE tranh_id = {tranh_id = '0'}

by

SELECT * FROM TranD WHERE tranh_id={tranh_id='0'}

Uli
Mon, Apr 11 2016 5:33 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kamran,

<< Removing all the spaces in the dataset query definition as you described in 2 fixed it. >>

Which version of EWB are you using ?  I just tried it here (2.04) and it seems to work fine with spaces.

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Apr 11 2016 6:16 AMPermanent Link

kamran

Good Morning Tim

Its version 2.04 build1

Thanks

Kamran

Tim Young [Elevate Software] wrote:

Kamran,

<< Removing all the spaces in the dataset query definition as you described in 2 fixed it. >>

Which version of EWB are you using ?  I just tried it here (2.04) and it seems to work fine with spaces.

Tim Young
Elevate Software
www.elevatesoft.com
Image