Mastodon
Programmierung

Database: D5/D6 Error with DB-Access

Q:
—-
I have two query connect to DBDemos.

Query1.sql
select name
from country

Query2.sql (connect to query1)
select *
from country
where name = :name

Query1 connect to a DBGrid and Query2 connect to a group of DBEdit.
Where I scroll Query1 record in DBGrid, Query2 record in DBEdit will
not change. But when I replace DBEdit to DBGrid and also connect to
Query2. It WORKS.

This error ever occured in Delphi 5 but solve in Delphi 5 Patch 1.

It is a simple error but a IMPORTANT bug.

A:
—-
Change TFieldDataLink’s UpdateField to

[code lang=”delphi”]procedure TFieldDataLink.UpdateField;
begin
SetField(nil);
if Active and (FFieldName <> ”) then
begin
if Assigned(FControl) then
SetField(GetFieldProperty(DataSource.DataSet, FControl, FFieldName)) else
SetField(DataSource.DataSet.FieldByName(FFieldName));
end
end;
[/code]

and statically link in the changed pas file. As you noticed this bug was in D5
shipping, fixed in SP1 but for some reason reverted back in D6 to the buggy
version.

0 Kommentare zu “Database: D5/D6 Error with DB-Access

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.