Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with Excel Date and CA
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Problem with Excel Date and CA
Versions des environnements
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Divers
Thread ID:
01434211
Message ID:
01434211
Vues:
125
I have a problems with dates when I try to import Excel 2007 files (not tested with earlier versions).

So I have this:
local loConnDataSource
loConnDataSource = createobject('ADODB.Connection')
lcFileName = GETFILE("XLSX")
TEXT TO lcConnectionString NOSHOW TEXTMERGE PRETEXT 15
     Provider=Microsoft.ACE.OLEDB.12.0;
     Data Source=<<m.lcFileName>>;
     Extended Properties="Excel 12.0;HDR=NO;IMEX=1;";
ENDTEXT
loConnDataSource.ConnectionString = m.lcConnectionString
loConnDataSource.Open()

oCA = CREATEOBJECT("CursorAdapter")
oCa.DataSource = createobject('ADODB.RecordSet')
oCa.DataSource.CursorLocation   = 3  && adUseClient
oCa.DataSource.LockType         = 3  && adLockOptimistic
oCa.DataSource.ActiveConnection = loConnDataSource


oCa.CursorFill()
BROWSE NORMAL
Everything is OK, but date columns in Excel.
Depending of chosen format I have:

20.09.2009 '3.' && And what is this '3.' is above me :-)
Wednesday, 20 September 2009
and many others.

How Can I tell this recordset to returns DATE not the whatever excel wants.
I forgot to mention that I have NO idea what type of data there will be in that Excel file beforehand, so I can't use CursorSchema. Don't want to use automation also :-)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform