DataTable删除行不生效 [英] DataTable delete row does not take effect
问题描述
嗨专家,
我希望你能帮助我。
我的VB.net代码中有12个数据表。
我有在记录集的事件的第一个表中添加。它有效。
如果第一个表中的记录集数量超过60,我必须取最旧的记录集并将其传输到第二个表。如果第二个表格包含在60以后,我必须再将最旧的一个表格转移到下一个表格。
执行直到QuellTabelle.Rows.Count = Pulse
Dim DT As DataRow = ZielTabelle.NewRow
' Debug.Print(QuellTabelle。行(0).Item(1))
Dim ODR As < span class =code-keyword>整数
对于 ODR = 0 ZielCol 步骤 1
DT.Item(ODR)= QuellTabelle.Rows( 0 )。Item(ODR)
下一步跨度> ODR
DT(Präfix_Ziel& _ Start)= CDate (现在)
DT(Präfix_Ziel& _ Temp)= CDbl (QuellTabelle.Rows( 0 )。项目(Präfix_Quelle& _ Temp))
ZielTabelle.Rows.Add(DT)
QuellTabelle.Rows( 0 )。删除()
循环
它适用于从第一个到第二个的转移非常好。但是从第二个到第三个我总是得到一个错误:
问题是,QuellTabelle.Rows.Count没有改变。我不明白为什么。删除命令后我该怎么做?
提前谢谢!
是的。 ..我不知道你在做什么...但也许你正在寻找这个:
DataTable.AcceptChanges [ ^ ]
试试这个:DataTable.AcceptChanges();
Hi experts,
I hope you can help me.
I have 12 datatables in my VB.net code.
I have to add in the first table on an event a recordset. It works.
If the number of recordsets in the first table is above 60, I have to take the oldest recordset and transfer it to the second table. If the second table contains after this more than 60, I have to transfer again the oldest one into the next table.
Do Until QuellTabelle.Rows.Count = Pulse
Dim DT As DataRow = ZielTabelle.NewRow
'Debug.Print(QuellTabelle.Rows(0).Item(1))
Dim ODR As Integer
For ODR = 0 To ZielCol Step 1
DT.Item(ODR) = QuellTabelle.Rows(0).Item(ODR)
Next ODR
DT(Präfix_Ziel & "_Start") = CDate(Now)
DT(Präfix_Ziel & "_Temp") = CDbl(QuellTabelle.Rows(0).Item(Präfix_Quelle & "_Temp"))
ZielTabelle.Rows.Add(DT)
QuellTabelle.Rows(0).Delete()
Loop
It works for the transfer from the first one to the second one really good. But from the second to the third I always get an error:
The problem is, that the QuellTabelle.Rows.Count does not change. And I do not understand why. What do I have to do after the delete command?
Thanks in advance!
Yeah...I have no idea what you are doing...but maybe you are looking for this:
DataTable.AcceptChanges[^]
Try This :DataTable.AcceptChanges();
这篇关于DataTable删除行不生效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!