VFP - SQLEXEC is returning DATE field as CHAR

1

I'm supporting a "legacy" application written in VFP, which uses DBF tables and is now migrating to SQL Server.

I created a table of tests in SQL, which contains fields of some basic types, to be able to work with the migration, performing tests of search, inclusion, change, etc.

The table has the following format:

CREATE TABLE [dbo].[teste](
  [CpTexto] [varchar](50) NULL,
  [CpData] [datetime] NULL,
  [CpDataTime] [datetime] NULL,
  [CpValor] [numeric](15, 5) NULL,
  [CpInteiro] [int] NULL,
  [ID] [int] IDENTITY(1,1) NOT NULL
  ) ON [PRIMARY]

From VFP I am querying using SQLEXEC, with the following syntax:

lnNumConex = 1
lnSQL = [SELECT * FROM TESTE]
lnTmpCur = [CurTESTE]
= SQLEXEC(lnNumConex,lnSQL,lnTmpCur)

When I do SQLEXEC, SQL returns a cursor, with all fields contained in the TEST table, but the cpDATA field instead of a field in DATE format, it returns as a CHAR field.

Does anyone know what's going on?

    
asked by anonymous 25.08.2014 / 20:24

1 answer

1

I was able to figure out what was wrong.

By default, the SQL connection used the native SQL Server driver installed on the pc

The Connection String was like this:
Driver={SQL Server};Server=XXX;Database=YYY;UID=fulano;PWD=senha;] ,

and when I passed the using the most current client I have (client 10.0), everything went well.

    
29.08.2014 / 18:32