Example in builder C++ 2010

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
[email protected]
Posts: 14
Joined: Mon 21 Jun 2010 13:55

Example in builder C++ 2010

Post by [email protected] » Tue 22 Jun 2010 08:45

Can we have same simple example in C++ of a connection with a table and the upgrate of it through append/post operation with PgDAC?

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Thu 24 Jun 2010 14:49

Hello

Please provide us your E-mail to send the sample application.

[email protected]
Posts: 14
Joined: Mon 21 Jun 2010 13:55

Post by [email protected] » Thu 24 Jun 2010 15:11

My E-Mail is [email protected]

[email protected]
Posts: 14
Joined: Mon 21 Jun 2010 13:55

Post by [email protected] » Tue 29 Jun 2010 11:43

Hello Boris,
I've opened your example and I've done this :
1. I've set a valid connection throw Username,pw, database, server, port of my system. And works.
2. I've run your application
3. I've press the button to Create the table. And works
4. I've Opened the table with your button. And Works
5. I've added 3 record pressing tree times your button 'Append data'. And OK
6. I've pressed the button 'Update data' and rise an Exception ' Update failed. Found 3 records'.
7. Closing the message the table seems good. But If I see the table with PgAdmin all the tree records are updated. Why? The same things is If I modify a record in the DBGrid and I press the 'post' button of the DB Navigator.

Thank you.
Fabio

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Wed 30 Jun 2010 14:00

Hello

If you press the 'Append data' button 3 times then 3 equal records will be added to database. When you try to update record then the following SQL query will be generated:

Code: Select all

update test_table set ID=..., Name='...' where ID=... and Name='...'
If several records have the same value in all fields then all these records will be updated. There is no other way to update a record. To update your table correctly you should create primary or unique key in your table and specify this key in the KeyFields property of TPgQuery or TPgTable.

You can learn how to add primary or unique key in the PostgreSQL documentation.

[email protected]
Posts: 14
Joined: Mon 21 Jun 2010 13:55

Post by [email protected] » Thu 01 Jul 2010 11:52

I've found the problem in my application. There is a field, in my table, named 'user' that give me the error in the INSERT and UPDATE procedure.

Thanks for the Help
Fabio

RichTat
Posts: 16
Joined: Tue 04 Mar 2008 17:10
Location: UK

Post by RichTat » Thu 22 Jul 2010 14:24

Hello bork

I have just installed UniDAC for RAD Studio 2010 but the example in Delphi 2010 won't compile - error cannot find DBAccess.
Could I have the C++ Builder 2010 sample also to try, please.
My email address is: [email protected]
Thanks
RichTat

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Fri 23 Jul 2010 16:15

Hello

The problem is that RAD Studio cannot find DBAccess file. There can be some causes:

1. UniDAC was installed incorrectly (for example if RAD Studio was run during UniDAC installation). Try to uninstall UniDAC and install it again without running RAD Studio. And please check after the installation that the library path was updated successfully. Check the value of RAD Studio -> Tools -> Options -> Library Win32 -> Library Path, it should contain the following paths: "C:\Program Files\Devart\UniDac for RAD Studio 2010\Lib" and "C:\Program Files\Devart\UniDac for RAD Studio 2010\Lib"

2. Please check if the C:\Program Files\Devart\UniDac for RAD Studio 2010\Lib folder contains the DBAccess file. If this file is unavailable then you don't have enough permissions. Try to install UniDAC to another folder or try to install it with administrator permissions.

3. If UniDAC was installed correctly and the C:\Program Files\Devart\UniDac for RAD Studio 2010\Lib folder contains the DBAccess file, then check if you have enough permissions for this folder.

We provide two demos for CBuilder. You can find them in the following folders: "C:\Program Files\Devart\UniDac for RAD Studio 2010\Demos\Miscellaneous\CBuilder\" and "C:\Program Files\Devart\UniDac for RAD Studio 2010\Demos\Miscellaneous\VirtualTableCB\"

Post Reply