SqlDataAdapter.Fill method slow

后端 未结 5 1307
暖寄归人
暖寄归人 2020-11-28 05:45

Why would a stored procedure that returns a table with 9 columns, 89 rows using this code take 60 seconds to execute (.NET 1.1) when it takes < 1 second to run in SQL Ser

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 06:24

    Why not make it a DataReader instead of DataAdapter, it looks like you have a singel result set and if you aren't going to be pushing changes back in the DB and don't need constraints applied in .NET code you shouldn't use the Adapter.

    EDIT:

    If you need it to be a DataTable you can still pull the data from the DB via a DataReader and then in .NET code use the DataReader to populate a DataTable. That should still be faster than relying on the DataSet and DataAdapter

提交回复
热议问题