I have two applications, one updates a single table which has constant number of rows (128 rows) using SqlDataAdapter.Update method , and another application that select from this table periodically using SqlDataReader.
我有两个应用程序,一个使用SqlDataAdapter.Update方法更新一个具有常量行数(128行)的表,另一个使用SqlDataReader定期从该表中选择的应用程序。
sometimes the DataReader returns only 127 rows not 128, and the update application does not remove or even insert any new rows, it just update.
有时DataReader只返回127行而不是128行,并且更新应用程序不会删除甚至插入任何新行,它只是更新。
I am asking what is the cause of this behaviour?
我在问这个行为的原因是什么?
1 个解决方案
#1
Yep, datareader requires an open connection and doesn't pull all the rows at the time the query was opened so you are pulling data real time from the server. This is unlike the DataTable which queries and puts all the information in a cached object (disconnected recordset).
是的,datareader需要打开连接,并且在打开查询时不会拉出所有行,因此您可以从服务器实时提取数据。这与DataTable不同,DataTable查询并将所有信息放入缓存对象(断开连接的记录集)中。
#1
Yep, datareader requires an open connection and doesn't pull all the rows at the time the query was opened so you are pulling data real time from the server. This is unlike the DataTable which queries and puts all the information in a cached object (disconnected recordset).
是的,datareader需要打开连接,并且在打开查询时不会拉出所有行,因此您可以从服务器实时提取数据。这与DataTable不同,DataTable查询并将所有信息放入缓存对象(断开连接的记录集)中。