I'm slowly converting my legacy VFP program to use the ADS Client API as often as possible. However, due to the sheer volume of code that uses these VFP tables, I on occasion find that I need to implement a Cursor Adapter in order to reuse the current VFP functions (SCAN, SCATTER MEMVAR, etc.). I just came across an annoying oddity and can't figure this out. Please help.

When I inspect specific records in the Data Architect, it displays a timestamp field of, for example, "08/31/2014 10:09:59". I assume this is the exact value in the table. However, when I inspect that same record in a VFP BROWSE after derived to a Cursor Adapter, it displays "08/31/2014 10:10:10". This difference occurs in only about 10% of the records, but it consistently displays the difference in the same records an is always exactly 1 second difference.

As a native VFP table, the field is defined as a VFP DATETIME type. Also I have the SET SECONDS turned ON in VFP.

Below is the code I use to derive a Cursor Adapter.

oConn = createobject('ADODB.Connection') oConn.Open(logConnString) oRS = CREATEOBJECT("ADODB.Recordset") oRS.DataSource.CursorLocation = 3 &&adUseClient oRS.DataSource.LockType = 3 &&adLockOptimistic oRS.ActiveConnection = oConn oCA=CREATEOBJECT("CursorAdapter") oCA.DataSourceType = "ADO" oCA.DataSource = oRS oCA.MapBinary = .T. oCA.MapVarchar = .T. oCA.Alias = "Log" oCA.Tables = "Log" oCA.CursorSchema = logSchema oCA.SelectCmd = "SELECT * FROM Log" oCA.CursorFill(.F., .F.)


asked 02 Sep '14, 15:18

gverge393's gravatar image

accept rate: 100%

I think this is because Visual Foxpro will round Timestamp values to the nearest second when milliseconds are included. I don't believe that ARC rounds. It just does not show them by default.

I've not tested it, but if you execute something similar it should show you the milliseconds. Are they .500+ for the records that are off by 1 second?

select cast(timestampfield as SQL_CHAR) from table

There was an inconsistency identified between what ADS stores in the table and VFP (Seems VFP never stores milliseconds?) What version of the server (or client if using LOCAL SERVER) are you using (full version with build numbers please)? I think they tried to make it consistent in and With these versions I believe the ADS server should round before sending the results for VFP tables types.


answered 02 Sep '14, 16:08

Edgar%20Sherman's gravatar image

Edgar Sherman
accept rate: 25%

Your answer to the original question.
If responding to a request for additional information, please edit the question or use the comment functionality.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 02 Sep '14, 15:18

Seen: 1,714 times

Last updated: 02 Sep '14, 16:08

Advantage Developer Zone Contact Us Privacy Policy Copyright Info

Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.