SQLCEException 未处理:内部错误:无法打开共享内存区域

发布于 2024-09-04 18:21:55 字数 815 浏览 2 评论 0原文

我正在尝试执行 TableAdapter.Fill(dataTable) 但失败并出现上述错误。这是...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 returnValue;
}

这是生成的代码。也许我需要改变一些事情?我想知道我的应用程序是否有多个到数据库的连接。这可能是什么?感谢您提供的任何帮助。

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

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 returnValue;
}

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

静谧幽蓝 2024-09-11 18:21:55

看来这个问题的答案是确保没有任何东西保持连接打开。由于我继承了这个问题,所以我不知道所有可以保持开放连接的东西。一旦我将连接集中在单个函数中,我就没有看到错误。

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.

浅黛梨妆こ 2024-09-11 18:21:55

好吧,我是不是觉得自己很蠢。即使有了之前的答案,我仍然偶尔会看到上述问题。最后我要解决这个问题,我只能说“呃”。我并没有关闭我的阅读器,在本例中是 SqlCeDataReader。一旦我关闭阅读器,一切都很好。使这个问题难以解决的原因是,一旦您忘记关闭应用程序中的读取器,下次尝试执行数据库操作时就会看到该问题。到那时你已经忘记了读者之前没有关闭。

我希望这对某人有帮助。我在其他地方都没有找到答案,所以如果这个答案确实有帮助,请投票。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文