博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

I have same SqlCeException as following

Posted on 2008-08-18 14:19  火星  阅读(552)  评论(1)    收藏  举报

The full error message plus Stack Trace that we get are as follows:

System.Data.SqlServerCe.SqlCeException was unhandled
  Message="There was an error parsing the query. [ Token line number = 1,Token line offset = 210,Token in error = INSERT ]"
  HResult=-2147217900
  NativeError=25501
  Source="SQL Server 2005 Mobile Edition ADO.NET Data Provider"
  StackTrace:
    at System.Data.SqlServerCe.SqlCeCommand.ProcessResults()
    at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
    at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand()
    at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()
    at EntitySpaces.SqlClientProvider.Ce.DataProvider.EntitySpaces.Interfaces.IDataProvider.ExecuteNonQuery()
    at EntitySpaces.Interfaces.esDataProvider.ExecuteNonQuery()
    at EntitySpaces.Core.esEntityCollection.ExecuteNonQuery()
    at EntitySpaces.Core.esEntityCollection.ExecuteNonQuery()
    at EntitySpaces.Core.esUtility.ExecuteNonQuery()
    at Mobile_Survey_Client.frmMenu.loadData()
    at Mobile_Survey_Client.frmMenu.menuNav()
    at Mobile_Survey_Client.frmMenu.outlookShortcutBar1_MouseUp()
    at System.Windows.Forms.Control.OnMouseUp()
    at Resco.Controls.OutlookControls.OutlookShortcutBar.OnMouseUp()
    at System.Windows.Forms.Control.WnProc()
    at System.Windows.Forms.ContainerControl.WnProc()
    at System.Windows.Forms.Control._InternalWnProc()
    at Microsoft.AGL.Forms.EVL.EnterMainLoop()
    at System.Windows.Forms.Application.Run()
    at Mobile_Survey_Client.Program.Main()

From that it does look like a SqlCe issue. It could just be that you can't execute multiple statements through ExecuteNonQuery, which seems weird as you can do it directly into SqlCe. The Sql that it falls over with is:

"INSERT INTO tblSurveySection(SurveySectionID, SurveyID, SectionID, HSID) VALUES ('1f22d882-9b86-4897-9481-184c93567bce', '4d88b4b7-e5c9-479f-86fb-04197dcae5ec', 'f79487a6-bf24-47fc-b17a-19aac03eab8a', '307'); INSERT INTO tblSurveySection(SurveySectionID, SurveyID, SectionID, HSID) VALUES ('7e84fdf0-cbfc-4f75-b99f-429b038acf02', '4d88b4b7-e5c9-479f-86fb-04197dcae5ec', '00146308-387c-43cb-9352-7bd89102588c', '308'); "