开发者

SQLCEException was unhandled: Internal Error: Cannot open the shared memory region

I am trying to do a TableAdapter.Fill(dataTable) and it fails with the above error. Here is the code in ...DataSet.Designer.cs

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Fill, true)]
public virtual int Fill(ZenwareDataSet.BatchPDADataTable dataTable) {

     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable); //  <---Fails here.
     return retur开发者_Python百科nValue;
}

This is generated code. Maybe there is something that I need to change? I am wondering if my app has multiple connections to the database. What can this be? Thanks for any help you can provide.

  • Windows Mobile 6.1 device (Trimble Juno SB)
  • SQLServerCompact 3.5 Service Pack 2
  • Microsoft .NET CF 3.5


It seems the answer to this question is to make sure nothing keeps a connection open. Since I had inherited this problem, I was not aware of everything that could hold an open connection. Once I centralized the connection in a single function I have not seen the error.


OK, do I feel stupid. Even with previous answer, I still was occasionally seeing the above issue. Finally I am addressing it, and all I can say is, "Duh". I wasn't closing my readers, in this case, SqlCeDataReader. Once I close the reader, everything is fine. What makes this problem hard to figure out is that once you forget to close a reader in your application, it is the next time you try to do a database operation that you see the issue. By then you have forgotten that the reader was not closed previously.

I hope this helps someone. I did not find the answer anywhere else I looked, so vote this answer up if it does help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜