Insert into syntax Error

Feb 21, 2012 at 8:18 AM

Hi Tom,

I come back from another project. I continue my tests on the provider.

I have a syntax error while saving changes.

The insert command is incorrect :

INSERT INTO 
  (SELECT 
      Dossiers.Reserve, 
      [...]
      Dossiers.Ententep
      FROM Dossiers Dossiers)(Reserve, [...] Ententep)
  values ('', [...] '')

It seems that the error is in (Change Set 88207)

File : Source\VfpEntityFrameworkProvider\Visitors\DmlSqlFormatter.cs

Function : GenerateInsertSql

Line (130) : dbExpression.Accept(formatter);

I continue on testing.

Nicolas

Coordinator
Feb 21, 2012 at 11:12 AM

The model for that table was setup as read only which is why the Insert statement includes a Select statement instead of a table name.  This happened due to the fact that a primary key couldn't be determined.  There are a few ways that you can handle this issue.

  • Modify the EDMX file so that the model is not read only.  This requires a bit of knowledge of the XML that makes up the EDMX file.
  • Add a candidate key to the table and re-create the model.
  • Switch over to "Code First" instead of using the EDMX.  This will allow you to easily define the model in code instead of having to learn the EDMX XML. 
Feb 21, 2012 at 12:08 PM

Thanks I will work on EDMX file.