BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get the previous value of a field

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Willy Verbiest
Guest





PostPosted: Tue Dec 09, 2003 4:02 pm    Post subject: How to get the previous value of a field Reply with quote



Hi,
I want to know the previous value of a field of an already posted record.
I'm working with TADOQuery in Delphi 6.
Thanks in advance,

Willy Verbiest


Back to top
baloonatic@hotmail.com
Guest





PostPosted: Tue Dec 09, 2003 6:31 pm    Post subject: Re: How to get the previous value of a field Reply with quote



After the new value's been posted ?. You need to save it before you
post it then . the 'old / previous value properties in the data
objects are for processing before you post. If you want after, easiest
way is to add a previous value field to the table and write to it each
time you post.
Back to top
Tomas Rutkauskas
Guest





PostPosted: Wed Dec 10, 2003 11:05 am    Post subject: Re: How to get the previous value of a field Reply with quote



You can find it with SQL LAST.
Like
select LAST(myfields) from mytable;

But it will works with new inserted record only.

"Brian Bushay TeamB" <BBushay (AT) Nmpls (DOT) com> wrote

Quote:

I want to know the previous value of a field of an already posted record.
I'm working with TADOQuery in Delphi 6.
Ado doesn't keep that information after Post unless you setLockType to
ltBatchoptomistic.

--
Brian Bushay (TeamB)
[email]Bbushay (AT) NMPLS (DOT) com[/email]



Back to top
Willy Verbiest
Guest





PostPosted: Wed Dec 10, 2003 1:12 pm    Post subject: Re: How to get the previous value of a field Reply with quote

Hi Brian,

Thanks for the response, but I think I didn't explain it right.
If a user select an existing record and modify this then before he Post it I
want to know what the value was the value of a field before he did some
editing on it.
I want ot know NewZipcode versus OldZipcode to take an example.
I use normally the following function to get the value of a field:
ZipCode := qryCustomers.FieldByName('Zipcode').AsString;
But this gives me the current value from the buffer and not the previous
posted one.
I want to know the value that is in the record in the database.

Thanks in advance,

Willy Verbiest


"Brian Bushay TeamB" <BBushay (AT) Nmpls (DOT) com> wrote

Quote:

I want to know the previous value of a field of an already posted record.
I'm working with TADOQuery in Delphi 6.
Ado doesn't keep that information after Post unless you setLockType to
ltBatchoptomistic.

--
Brian Bushay (TeamB)
[email]Bbushay (AT) NMPLS (DOT) com[/email]



Back to top
baloonatic@hotmail.com
Guest





PostPosted: Wed Dec 10, 2003 7:02 pm    Post subject: Re: How to get the previous value of a field Reply with quote

There's a variant property of TField called oldvalue with the
originally retrieved data in it.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.