Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel 2007
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Excel 2007
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01362308
Message ID:
01362308
Views:
57
I have been searching over the weekend for an environment variable that would cause us not to be able to open Excel 2007 via its OLE connection string. If I run my 3 lines of code from the command window or a stand lone prg it works fine. If I run it from within our app I get an error "Database or object is read-only". The file is not read-only and I have started fox and come in fresh a couple of times. I have tried most all of the SET comands we set to no avail. Any ideas on what would make this happen? The sheet in the xlsx file is called "sheet1".

Code:
lcConn = "Driver={Microsoft Excel Driver (*.xls, *.xlslx, *.xlsm, *.xlsb) }; DBQ= " + tcFile + ": Provider=Mircosoft.ACE.OLEDB.12.0; Extended Properties=Excel 12.0;"

lnHandle = SQLSTRINGCONNECT( lcConn )

if lnHandle > 0
    lnSuccess = SQLEXEC( lnHandle, "SELECT * FROM [Sheet1$]", "mycursor" )
ENDIF 

SQLDISCONNECT( lnHandle )
I have tried several variations of the connection string and also have tried opening Excel via the creating of and ADODB.Connection and Recordset and using XmlDom to get teh sheet into a cursor. All fail with read-only error.
Next
Reply
Map
View

Click here to load this message in the networking platform