URGENT Writing the contents of data-aware controls to the database TOUGH ONE

URGENT Writing the contents of data-aware controls to the database TOUGH ONE

Post by Coen De Roove » Sun, 04 Mar 2001 21:34:17



Hi,
I have some data aware controls whose content is calculated with the value
of other  data aware components. When the user changes the value of one
component, the value of the others is recalculated. Everything works fine
until I do a Post command, then the content of the components changes to
some rubbish.

So the application calculates everything fine, but when I write it to the
database things go wrong.

Thanks in advance,
Coen De Roover


 
 
 

URGENT Writing the contents of data-aware controls to the database TOUGH ONE

Post by Dan Brenna » Mon, 05 Mar 2001 02:57:36


I need a little help here: What is doing the calculations? Is it the
underlying dataset? Is that a TTable or TQuery?
Cached updates?
Live query?

Have you used the de* to step through you code to see if things
are when you expect them to?

Just a wild guess: maybe the recalculation uses some old values where
it should use new values.

Dan

On Sat, 3 Mar 2001 13:34:17 +0100, "Coen De Roover"


>Hi,
>I have some data aware controls whose content is calculated with the value
>of other  data aware components. When the user changes the value of one
>component, the value of the others is recalculated. Everything works fine
>until I do a Post command, then the content of the components changes to
>some rubbish.

>So the application calculates everything fine, but when I write it to the
>database things go wrong.

>Thanks in advance,
>Coen De Roover



--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control:
visit us at www.cmdcsystems.com


 
 
 

URGENT Writing the contents of data-aware controls to the database TOUGH ONE

Post by Kurt Kosn » Mon, 05 Mar 2001 03:10:52


Hello :)

I had some trouble like that - just a hint -
look at the onEVENTs - maybe they will be triggered -
and 'go to work'
In my case I had to rewrite the 'onChange' event !

regards Kos

On Sat, 3 Mar 2001 13:34:17 +0100, "Coen De Roover"


>Hi,
>I have some data aware controls whose content is calculated with the value
>of other  data aware components. When the user changes the value of one
>component, the value of the others is recalculated. Everything works fine
>until I do a Post command, then the content of the components changes to
>some rubbish.

>So the application calculates everything fine, but when I write it to the
>database things go wrong.

>Thanks in advance,
>Coen De Roover



 
 
 

URGENT Writing the contents of data-aware controls to the database TOUGH ONE

Post by Alan Jeffer » Mon, 05 Mar 2001 16:12:24


Coen

Without seeing your code I can't be very specific in my assistance.
However, in similar situations, I use memory variables rather than live
data.  Do the changes in a 'GetValues" and then save them in a "PutValues'
function that also checks for success.

Alan Jeffery
Professional Systems



> Hi,
> I have some data aware controls whose content is calculated with the value
> of other  data aware components. When the user changes the value of one
> component, the value of the others is recalculated. Everything works fine
> until I do a Post command, then the content of the components changes to
> some rubbish.

> So the application calculates everything fine, but when I write it to the
> database things go wrong.

> Thanks in advance,
> Coen De Roover



 
 
 

URGENT Writing the contents of data-aware controls to the database TOUGH ONE

Post by Coen » Mon, 05 Mar 2001 22:12:49


Thank you all for your replies, but I guess I'll have to be a bit more
specific:
Actually I'm doing nothing fancy.
I have some dbedit components on a form and I'm calculating the value of
some of them by using the .text property of some others. Everything goes
fine (the controls contain the right values), but when I do a post command
to the database, some values change.



> Hi,
> I have some data aware controls whose content is calculated with the value
> of other  data aware components. When the user changes the value of one
> component, the value of the others is recalculated. Everything works fine
> until I do a Post command, then the content of the components changes to
> some rubbish.

> So the application calculates everything fine, but when I write it to the
> database things go wrong.

> Thanks in advance,
> Coen De Roover



 
 
 

URGENT Writing the contents of data-aware controls to the database TOUGH ONE

Post by Coen » Mon, 05 Mar 2001 22:14:58


I mean I'm using the onchange events of the component to calculate the other
values

Coen

 
 
 

URGENT Writing the contents of data-aware controls to the database TOUGH ONE

Post by Markku Nevalaine » Mon, 05 Mar 2001 23:55:44



> I have some dbedit components on a form and I'm calculating the value of
> some of them by using the .text property of some others. Everything goes
> fine (the controls contain the right values), but when I do a post command
> to the database, some values change.

Yes, this is a bit tricky task, when the all the linked controls circumvent,
and everyone tries to update each others.

You'll just have to replace most of those TDbEdits with usual TEdits.
Use TDataSource's OnDataChange event to keep the right, updated values
on these TEdits.

Also use the OnExit events of both the TDbEdit and TEdit to update the
values in the other controls.

Plain TEdit control is very limited, not even having RightAlign property
for the text. You'll probably have to pick some free TEdit alternative
for it.

Markku Nevalainen

 
 
 

URGENT Writing the contents of data-aware controls to the database TOUGH ONE

Post by Dan Brenna » Tue, 06 Mar 2001 09:40:46


On Sun, 4 Mar 2001 14:14:58 +0100, "Coen"


>I mean I'm using the onchange events of the component to calculate the other
>values

>Coen

Aha! This may be the smoking gun ;)
Even if you can figure out the exact order of calculations, it may be
too risky to use these events where there may be a problem to keep
things working as you develop your app. (see Markku's remarks today)

You might try something like turning RequestLive off in the TQuery,
and then use UpdateSQL to write the changes back to the DB. This will
allow you to do the calculations in a procedure, separate from the
database operations. It should be much easier to understand what's
going on sometime in the future when you need to maintain this code ;)

Dan

--
Dan Brennand
CMDC systems, inc.
Configuration Management and Document Control:
visit us at www.cmdcsystems.com

 
 
 

1. Data-aware controls that be aware of nothing

I'm puzzled (but I'm not a guru) with this.

I want to insert data into two tables through two TQuery in
a Client/server application. Both tables are related in a
master/detail relationship with a field (NH) that is the
primary key in the master table. The detail table has
another primary key (NI).

I've built a form divided into two moities with data-aware
controls for fields from both Tquery. In the OnCreateForm
procedure  I start a explicit transaction, and prepare, open
and insert on both TQuery.

The problem is that the controls which have to be aware of
the fields of the first TQuery do it OK, but not the others.
And I know that the record in the second TQuery is inserted
and in dsInsert mode, because I can assign values to this
record through code, but not through the data-aware
controls.

Can anybody help me?

Thanks.

Sent from RemarQ http://www.remarq.com/?z The Internet's Discussion Network
The fastest and easiest way to search and participate in Usenet - Free!

2. Referential Integrity for XOR relationship

3. large local databases and data-aware controls

4. SQL Svr 2000 MSDATASHAPE Error: "Data provider or other service returned an E_FAIL status"

5. Data Aware OCXs and Data Controls

6. LONDON-UK. ORACLE DBA-Banking. Attractive financial pkg

7. Writing Data Aware components

8. sintax???

9. Urgent!!!!!!!!!How to add a record in data-aware class

10. ESBPCS has Improved Data Aware Controls

11. Data aware controls - any good?

12. Data-aware combo control

13. Non-Data aware controls and ADO