Example in builder C++ 2010
-
- Posts: 14
- Joined: Mon 21 Jun 2010 13:55
Example in builder C++ 2010
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?
-
- Posts: 14
- Joined: Mon 21 Jun 2010 13:55
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
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
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:
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.
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='...'
You can learn how to add primary or unique key in the PostgreSQL documentation.
-
- Posts: 14
- Joined: Mon 21 Jun 2010 13:55
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
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
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\"
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\"