本文介绍了DataSet - 添加新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 如果我填写数据集并且没有数据。仍然创建数据集 ,零行(所有列都在那里)。当我使用 添加我的第一行时,下面的脚本需要超过2秒才能添加???如果我添加第二个 行,即时。 如何消除这种延迟? Dim oRow As DataRow = dsOrder.Tables(" PaymentsAndCredits")。NewRow oRow(" ENumber")= ENumber oRow(" ; CNumber")= CNumber oRow(" PType")=类型 oRow(PAmount)=金额 oRow( TNumber)= 0 oRow(TAdjustment)= 0 oRow(应用)=错误 dsOrder.Tables(" PaymentsAndCredits")。Rows.Add(oRow) 解决方案 尝试在每一行之间倾销DateTime.Now, 这样你就可以看到时间在哪里。 你可能只是看到JITting,但它听起来不太可能,如果它花了2美元b 。这是什么类型的机器? - Jon Skeet - < sk *** @ pobox.com> http://www.pobox.com/~skeet 如果回复小组,请不要给我发邮件 2秒听起来很长时间。你知道它在哪个部分花时间吗?尝试在每行之间转出DateTime.Now,这样你就可以看到时间在哪里。 你可能只是看到JITting,但如果它正在采取 2秒。这是什么类型的机器? 你有很多限制因素检查其他表吗?如果您只是从头开始创建数据集 而不涉及任何地方的数据库,只需添加简单的列? $ b $ b - Jon Skeet - < sk *** @ pobox.com> http://www.pobox.com/~skeet 如果回复小组,请不要给我发邮件 If I fill my dataset and there is no data. The dataset is still createdwith zero rows (all columns are there). When I add my first row usingthe script below, it takes over 2 seconds to add??? If I add the secondrow, instant.How can I eliminate this delay?Dim oRow As DataRow = dsOrder.Tables("PaymentsAndCredits").NewRowoRow("ENumber") = ENumberoRow("CNumber") = CNumberoRow("PType") = typeoRow("PAmount") = amountoRow("TNumber") = 0oRow("TAdjustment") = 0oRow("Applied") = FalsedsOrder.Tables("PaymentsAndCredits").Rows.Add(oRow ) 解决方案2 seconds sounds like a very long time. Do you know which part it isthat''s taking the time? Try dumping out DateTime.Now between each line,so you can see where the time is taken.You could just be seeing JITting, but it sounds unlikely if it''s taking2 seconds. What kind of machine is this on?--Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeetIf replying to the group, please do not mail me too 2 seconds sounds like a very long time. Do you know which part it is that''s taking the time? Try dumping out DateTime.Now between each line, so you can see where the time is taken. You could just be seeing JITting, but it sounds unlikely if it''s taking 2 seconds. What kind of machine is this on?Do you have a lot of constraints involved which check other tables? Doyou get a similar hit if you just create the dataset from scratchwithout involving the database anywhere, just adding simple columns?--Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeetIf replying to the group, please do not mail me too 这篇关于DataSet - 添加新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 00:49