Solved

Multi-table update using ADO

Posted on 2008-10-09
3
352 Views
Last Modified: 2013-11-23
I'm converting an old application to ADO from BDE and need some help.

A BDEClientdataset has been used to call a stored procedure (via commandtext) to return multi-table data to the screen. The data on-screen is edited in a DB-Aware manner and then, in the OnBeforeUpdateRecord , the data is stored away via another stored procedure and the dataset marked as applied. This all worked fine, but now I need it as ADO.

Just as a test, I added a TADOStoredProc, setting this to the procedure that returns the data and connected it all up. This works fine, returning the data to the screen. I had coded nothing else, but it allowed me to edit some of the fields in the dataset and then post them and it updates the DB.

I didn't expect to be able to edit the dataset let alone it actually updating the DB.

However I need to be able to update all fields as post them to the DB via one means or another. If anyone can help with this that would be great.

N.B. working with SQL Server 2000 & Delphi 6   :-E
0
Comment
Question by:Bongos
  • 2
3 Comments
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 22677301
the last thing for the fields to be editable must be a simple select fields

if you do calculating on a field, like
SELECT ISNULL(Test, 0) TEST ...
will make this field readonly

SELECT A.TEST FROM
(SELECT ISNULL(Test, 0) TEST ...) AS A

should solve this problem

otherwise a little more specifics about the fields not editable ...

0
 
LVL 2

Author Comment

by:Bongos
ID: 22677610
OK, I understand about making the fields editable. For storing the changes am I best to capture the BeforePost and store away via my previous stored proc as I presume it'll no longer update the DB directly?
0
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 125 total points
ID: 22678142
it will update a cache and then do BeforePost
I don't use ADO anymore, but it seems a good choice to post the updates
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question