Board index » delphi » Data aware components

Data aware components


2005-10-13 07:03:32 PM
delphi80
This isn't a specific problem, more of a general approach issue.
Using any of the datasets, be it a SimpleDataset or an SQLQuery with data
aware components via DSP, CDS and DataSource, there do seem to be a number
of issues with errors such as 'Record not found or changed by another user'
or 'Unable to find record. No key specified' which occur when using
ApplyUpdates.
Now, I have absolutely no doubt that if I was a better programmer with a
better understanding of how these components work, I could avoid all of
these problems, but the fact remains that I keep coming across issues.
However, if I ignore data aware components, set component values
programmatically from dataset persistent fields and then insert or update
records using an SQL script instead, I get no problems at all.
So, is avoiding data aware components a common approach or am I simply
making hard work for myself which negates the point of using Delphi for
database applications?
Thanks.
 
 

Re:Data aware components

Tim writes:
Quote
So, is avoiding data aware components a common approach or am I simply
making hard work for myself which negates the point of using Delphi
for database applications?
Avoiding data-aware components is not common in the Delphi world if
you exclude people who were scared away from them by VB.
If you're going to avoid data-aware components then you should use a
different tool to avoid creating all that work for yourself, like an
O/R mapper or ECO.
But your problems are pretty simple to solve. For example, "No key
specified" means you didn't set the pfInKey ProviderFlag on the TField
corresponding to the primary key of your table. "Record not found or
changed by another user" means that the UPDATE statement affected 0
records, which could also be caused by incorrect ProviderFlags
settings. These issues, in other words, have nothing to do with
data-aware controls and everything to do with TClientDataset /
TDatasetProvider, and it is *very* worth your time to learn how to use
these correctly.
Here's some articles which might help:
bdn.borland.com/borcon2004/article/paper/0,1963,32229,00.html
bdn.borland.com/article/borcon/files/2106/paper/2106.html
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
Borland newsgroup denizen Sergio Gonzalez has a new CD of
Irish music out, and it is good: tinyurl.com/7hgfr
 

Re:Data aware components

craig,
(or anyone) -a somewhat related question regarding:
Quote
Here's some articles which might help:

bdn.borland.com/borcon2004/article/paper/0,1963,32229,00.html
bdn.borland.com/article/borcon/files/2106/paper/2106.html
is there a master listing, index, or table of contents for all the
various docs, papers, etc. that borland has up and spinning?
-paladin
 

Re:Data aware components

"Craig Stuntz [TeamB]" <XXXX@XXXXX.COM [a.k.a. acm.org]>wrote
in message news:434e75e6$XXXX@XXXXX.COM...
Quote

Avoiding data-aware components is not common in the Delphi world if
you exclude people who were scared away from them by VB.

But your problems are pretty simple to solve...
Thanks Craig. I hear what you're saying and I will checks out the links.
Tim
 

Re:Data aware components

paladin writes:
Quote
is there a master listing, index, or table of contents for all the
various docs, papers, etc. that borland has up and spinning?
I always use Google site search.
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
Useful articles about InterBase development:
blogs.teamb.com/craigstuntz/category/21.aspx
 

Re:Data aware components

Quote
>is there a master listing, index, or table of contents for all the
>various docs, papers, etc. that borland has up and spinning?

I always use Google site search.
so... that is a no?
 

Re:Data aware components

paladin writes:
Quote
>>is there a master listing, index, or table of contents for all the
>>various docs, papers, etc. that borland has up and spinning?
>
>I always use Google site search.

so... that is a no?
No, it is not a no (sorry for the triple negative :). There's a
TOC-style navigation interface as well. For example, go to
bdn.borland.com, hold your cursor over "IDE," and click
"Delphi." You now have a menu on the left with sub-categories of Delphi
which you can choose.
I'm just saying I find that a very inefficient process in comparison
to Googling the subject I am looking for.
--
Craig Stuntz [TeamB] . Vertex Systems Corp. . Columbus, OH
Delphi/InterBase Weblog : blogs.teamb.com/craigstuntz
All the great TeamB service you've come to expect plus (New!)
Irish Tin Whistle tips: learningtowhistle.blogspot.com
 

Re:Data aware components

"Craig Stuntz [TeamB]" <XXXX@XXXXX.COM [a.k.a. acm.org]>wrote
in message news:434e75e6$XXXX@XXXXX.COM...
Quote

But your problems are pretty simple to solve. For example, "No key
specified" means you didn't set the pfInKey ProviderFlag on the TField
corresponding to the primary key of your table. "Record not found or
changed by another user" means that the UPDATE statement affected 0
records, which could also be caused by incorrect ProviderFlags
settings. These issues, in other words, have nothing to do with
data-aware controls and everything to do with TClientDataset /
TDatasetProvider, and it is *very* worth your time to learn how to use
these correctly.
Craig,
For what its worth, I have discovered the source of the problems. Corrupt
tables. They can be viewed OK, but couldn't be written to properly. Deleted
the tables, recreated them and all is fine.
Tim