Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Connecting to Excel from VFP
Message
From
24/10/2012 20:31:32
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01555746
Message ID:
01555747
Views:
66
Option 2 won't work. OLEDB is not the same as ODBC. You can't use an OLEDB provider that way.

>Could anybody see why the following two ways of using Access Jet driver give me different results:
>
>1. I get no problem and no error when I create ADODB connection object using the following connection string and the
>following code:
>
>
>cConnString = 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=' + m.tcXLSFile + ';
> Extended Properties="Excel 12.0;HDR=' + m.lcHeaderRow + '"'
>
>Local oConn As 'ADODB.Connection'
>  Local oRS As ADODB.RecordSet
>  oConn = Createobject('ADODB.Connection')
>  oConn.Mode= 1 
>  oConn.Open(cConnString )
>  oRS = oConn.Execute(m.tcQuery)
>
>
>
>2. But when I try to connect to the same Excel spreadsheet file using SQLSTRINGCONNECT() I get a pop-up window that prompts me to select/enter a DSN file:
>
>
>cConnString = 'Provider=Microsoft.ACE.OLEDB.12.0;Data Source=' + m.tcXLSFile + ';
>Extended Properties="Excel 12.0;HDR=' + m.lcHeaderRow + '"'
>
>m.lnSQL = SQLSTRINGCONNECT(cConnString)
>
>
>As you can see above that the connecting string is the same but the second case is not working.
>
>TIA.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform