Solved

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

Posted on 2004-08-18
10
315 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
TVirtualStringTree  search using TEdit 7 106
How to open a new windows chrome resized and disabled the toolbar? 3 82
LAN or WAN ? 11 82
SUM 2 INTEGER ARRAYS INTO 1 10 93
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now