Solved

Master/Slave Tables in Delphi 7 using MSAccess DBs result in "not a valid timestamp" error/exception

Posted on 2004-08-18
10
317 Views
Last Modified: 2010-04-05
I have converted a Delphi 5 program to Delphi 7 which uses two MS Access tables, a master and a slave.  Each has a datetime field in the primary key, which correspond.

When I to a TTable.Insert on Table 1 (master), I get an exception "0.0 is not a valid timestamp".  The error occurs because Table 2 (slave) uses the datetime field in its master/slave key specifications.  I know this because if I unlink the two tables and do an insert on each of them, I get no error.

     TblTrustReq1.Open;
     TblTrustReq2.Open;
     TblTrustReq1.Append;
     TblTrustReq1CHKRequesterID.Value := 'KG';
     TblTrustReq1CHKRequesterDate.Value := Now;
     TblTrustReq1CHKCheckDate.Value := Now;

     TblTrustReq2.Append;
     TblTrustReq2CHKRequesterID2.Value := TblTrustReq1CHKRequesterID.Value;
     TblTrustReq2CHKDate.Value := TblTrustReq1CHKRequesterDate.Value;
     TblTrustReq2CHKSequence.Value := 1;

Can anyone help?

Keith
0
Comment
Question by:Kgondron
10 Comments
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 11832215
You're appending but not posting the changes. Any reasons why? Or did you forget to cut that part of the code. :)
0
 

Author Comment

by:Kgondron
ID: 11832325
That comes later.  First I have to fill in other fields.  This bombs out immediately on doing the TblTrustReq1.Append;
KG
0
 

Author Comment

by:Kgondron
ID: 11832639
Forget to mention:  I am using Reggatta's Titan for Access components to access the MS Access databases.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 14

Expert Comment

by:Pierre Cornelius
ID: 11835825
Your problem is that the function Now returns a TDateTime result whereas (judging from your error message) a Timestamp value is expected.

Use the following:
TblTrustReq1CHKRequesterDate.Value := DateTimeToTimeStamp(Now);
TblTrustReq1CHKCheckDate.Value := DateTimeToTimeStamp(Now);

The above assumes your Regatta component want a TTimestamp value.

If the above still doesn't work, your component probably doesn't support the delphi datatypes in which case you would have to convert your datetime value to an access date data type.

Kind regards
Pierre Cornelius
0
 
LVL 14

Expert Comment

by:Pierre Cornelius
ID: 11835850
Just another thought:

Try this:
TblTrustReq1CHKRequesterDate.AsDateTime := Now;
TblTrustReq1CHKCheckDate.AsDateTime := Now;

Regards
Pierre

0
 
LVL 6

Expert Comment

by:bpana
ID: 11839146
you should post the changes on the first table before starting to modify the second one.

  TblTrustReq1CHKCheckDate.Value := Now;
  TblTrustReq1CHKCheckDate.Post;
...

but if you say that this line gives the error:
  TblTrustReq1.Append;
that should be something else.
0
 

Author Comment

by:Kgondron
ID: 13345684
Nice try, guys, it's been so long ago that I got around this problem, it was hard to remember how it was solved.  Actually I contacted the Titan guy and he modified the Titan Access code because it had a bug in it.

Thanks anyway.
0
 

Accepted Solution

by:
PAQ_Man earned 0 total points
ID: 15015564
PAQed with points refunded (500)

PAQ_Man
Community Support Moderator
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

773 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