Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is wrong with this SQL Select?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01556973
Message ID:
01557019
Views:
85
>>Hi,
>>
>>When I connect from a test vfp program to an Excel spreadsheet file (via ODBC driver) using the following syntax:
>>
>>
>>cSqlSelect = 'SELECT A,B FROM "SHEET1$" WHERE 1=1'
>>nResult = SQLEXEC( m.lnSQL, cSqlSelect, m.TempAlias )
>>
>>
>>The error is "Too few parameters. Expected 2". Note that m.lnSQL has a valid handle (1) upon connecting to the Excel file.
>>
>>What is the 2nd parameter I am missing? TIA.
>
>Hi Dmitry
>
>What are A,B in your query? Probably ODBC driver is looking for field names that are supposed to be in the very first row. What field names are you getting for 'SELECT * FROM "SHEET1$" WHERE 1=1' ?

Hi Yuri,

The A,B in my sql select expression meant to be column A and B of the spreadsheet. I took this code from the code published by sweetpotatosoftware blog on how to convert excel file to VFP table. Now that I changed the code to * in place of A,B I don't get the error. Thank you very much!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform