delphi - Stale data returned when re-running a query with an empty result -


i using uib in delphi 2010 application. reuse tuibquery component across several executions different parameters. when parameter-value returns empty dataset access fields returns stale data.

here pseudocode representation/extract of do:

// open query set of parameter values  q.params.bynameasinteger[aparamname] := 1; q.open; // parameter value data returned, access first record: := q.fields.bynameasinteger[afieldname]; q.close;  // open query different set of parameter values  q.params.bynameasinteger[aparamname] := 2; q.open; // parameter value there no data on db. j := q.fields.bynameasinteger[afieldname]; q.close; 

what after last open() is

q.eof = true q.bof = true = j // non-null value 

so know result set empty, still returns value afieldname queried when resultset not empty old parameter-valie when accessing field name.

i rather have give null (or 0 access asinteger()) field.

my workaround test eof=bof=true, there more elegant way?

in real code 2 open() calls in separate web-requests. there way of explicitly resetting field values when call close()?

thank reading , devoting thought it.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -