Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with Excel Date and CA
Message
De
11/11/2009 08:15:18
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Divers
Thread ID:
01434211
Message ID:
01434214
Vues:
58
>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 :-)

Hi Boris,
Might that be time portion, cut off?
If creators of excel doesn't format those as date columns then would have problems I think.

What does oCA.DataSource.Fields("yourDateField").Type show? Is that date/time? 7,133,134,135 ?
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform