Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Excel Date and CA
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Problem with Excel Date and CA
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01434211
Message ID:
01434211
Views:
126
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.
Next
Reply
Map
View

Click here to load this message in the networking platform