Open ontytoom opened 7 years ago
The problem isn’t with the @ symbol. It is true that the VFP oledb provider, using OleDbCommand, doesn’t handle name parameters. But I wrote a wrapper class to allow named parameters.
As you’ve probably noticed, the insert statement is attempting to insert into a select statement instead of a table as you would normally expect. This comment on a previous issue explains why this happens in the EDMX along with possible solutions.
Many thanks for quick response and for the info.
Indeed, when viewing the EDMX file via text editor, I see messages like this all over the place:
Errors Found During Generation: warning 6002: The table/view 'Sname' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view.
Unfortunately, I cannot change the schema of the VFP database. We are integrating with an off the shelf package and are not at liberty to tinker with its schema. None of the tables have primary keys defined. The schema is exceptionally complex (close to 380 tables, with the widest table having 250 columns). I could possibly go code-first if I knew the schema, but given its complexity it would be much more preferable to have the entities generated for me.
I will review all the links you provided in detail, and will post any follow-up questions.
No need to changed the database schema. Just use code-first. This link shows you how to get started. It will generate all the models for you. You'll just have to fix the primary key mapping.
Hello Tom,
I am running into an issue when using your provider in my application.
In short, the following SQL Insert statement gets sent to VFP and is rejected as having a syntax error:
The resulting error is:
I found a StackOverflow post saying that named parameters with @ sumbol are not supported by VFP: https://stackoverflow.com/questions/16386352/sql-parametrized-syntax-error-with-vfp-oledb
I am not confident where the error occurs, so I opened this issue in hopes to shed more light on the query composition process. If you might have any workarounds in mind, I will gladly try them out. Also, please let me know if you need any additional info from me to research this issue.
Many thanks for all your work and for your kind support!
NOTE: I also posted on StackOverflow in case someone there might be of help: https://stackoverflow.com/questions/44219602/visual-foxpro-syntax-error-in-insert-statement-when-using-entity-framework-and