>The sqlexec() errors after a successful connection handle has been created:
>
>
>lcFileIn = "C:\Test\Per-Key Generic Template Sheet.xls"
>lcConnstr = "Driver={Microsoft Excel Driver (*.xls)};DBQ=" + lcFileIn + ";"
>lnSQLHand = SQLSTRINGCONNECT( lcConnstr )
>? lnSQLHand
>? SQLEXEC( lnSQLHand, 'Select * FROM "DataEntry$"', 'trt' )
>
>
>The error is Connectivity error: [Microsoft][ODBC Excel Driver] The connection for viewing your linked Microsoft Excel worksheet was lost.
>
>a copy of the file with no spaces in the filename works perfectly fine:
>
>
>lcFileIn = "C:\Test\Per-KeyGenericTemplateSheet.xls"
>lcConnstr = "Driver={Microsoft Excel Driver (*.xls)};DBQ=" + lcFileIn + ";"
>lnSQLHand = SQLSTRINGCONNECT( lcConnstr )
>? lnSQLHand
>? SQLEXEC( lnSQLHand, 'Select * FROM "DataEntry$"', 'trt' )
>
>
>And of course every example I can find on the web
never has spaces in the path... putting it in quotes and braces has not worked either. So how does one specify spaces in their DBQ in VFP6? FWIW the code doesn't error in VFP8.
The first idea that comes to mind (may be wrong) - did you try to use shortname (DOS style)?
If it's not broken, fix it until it is.
My Blog