此行已从表中删除... [英] This row has been removed from a table...

查看:583
本文介绍了此行已从表中删除...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此行已从表中删除,但没有任何数据。 BeginEdit()将允许在此行中创建新数据。

我在测试网站时在日志文件中收到错误。你可以告诉我这个问题的解决方案..

This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row.
I got an error in the log file while testing the website . can u please tell me the solution for this issue..

推荐答案

这里讨论并解决了类似的问题:这里 [ ^ ]



总的来说,它说:

根据例外情况,您似乎尝试读取已经删除的行。



所以我认为应该添加一些逻辑来避免这种情况。

1.检查目标行是否存在;

2.当它存在时,做一些事情。
Here similar issue discussed and resolved: here[^]

Overall, it says:
According to the exception, it seems that you try to read a row which has been deleted already.

So I think some logic should be added to avoid this.
1. check if the target row is existed ;
2. When it is existed, do something.


我的代码也出现了同样的错误



此行已从表中删除且没有任何数据。 BeginEdit()将允许在此行中创建新数据。



我是如何使用linq将datagridview与表绑定..



我将我的代码更改为

I was also getting the same error with my code

This row has been removed from a table and does not have any data. BeginEdit() will allow creation of new data in this row.

How ever i was binding datagridview with table using linq..

I change my code to
<pre lang="c#">
var qry = from si in tempdset.ItemSuppliers.AsEnumerable()
          where si.itemid == Convert.ToInt32(cmbSuppItem.SelectedValue.ToString())
          select si;
DataGridview1.DataSource = qry.AsDataView();





来自



from

<pre><pre lang="c#">
var qry = from si in tempdset.ItemSuppliers.AsEnumerable()
          where si.itemid == Convert.ToInt32(cmbSuppItem.SelectedValue.ToString())
          select si;
DataGridview1.DataSource = qry.ToList();
</pre></pre>





其中,

temdset是一个DataSet,而ItemSuppliers是表名。



where,
temdset is a DataSet and ItemSuppliers is table name.


这篇关于此行已从表中删除...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆