Column does not belong to table error!

对于新手来说这个问题可能会比较常见,但你在GridView中引用了一个在数据库中或者SQL语句中不存在的列时!就会出现这个错误!

我们今天讨论的是导致这个问题出现的第二个原因:

就是在有并发出现的Web应用中!用了Static方法来存储从数据库中去值时偶尔会出现这种问题! 问题出现的时候!需要重启应用程序池!最近事情多,具体的原因还没有探究。当把这个static发法改为非static时,就不会出现这个问题。

思路来自下面的帖子感兴趣的可以看一下:

http://www.velocityreviews.com/forums/t369009-p2-column-does-not-belong-to-table-error.html

主要是tferris的回复,下面是回复内容:


We had this exact problem and we solved it.


Using static (C#) or shared (VB) .Net data classes on a multi-processor server will cause this error. The data class and its objects, e.g. DataTable, get resused across threads for some reason. So when when two requests come in at the same time, the second request overwrote the DataTable object variable with its own results, causing the first request to fail when it went looking for its tables, columns, etc.
This problem only occurred on multi-processor servers and went away when we declared our data classes without static or shared.
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值