0

When I create a stored procedure, I use

  SET NOCOUNT ON

as this speeds up execution time. From this question, SET NOCOUNT ON usage, using SqlDataAdapter relies upon the rows affected value to be returned. I was wondering if you work with an alternative class that works well for:-

  • IF EXISTS to avoid duplicates (no rows affected message)
  • Note: use with caution WHERE NOT EXISTS (less rows then expected filter out trivial updates (eg no data actually changes)
  • Do any table access before (such as logging) Hide complexity or denormlisation
  • etc
Community
  • 1
  • 1

1 Answers1

1

You could use SqlDataReader. It is a lower level interface that allows you to process each row individually and only extract data you need. It does buffering of results internally.

https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader%28v=vs.110%29.aspx

If you want a simple ORM that hides complexity look at Dapper: https://code.google.com/p/dapper-dot-net/

GameSalutes
  • 1,762
  • 2
  • 18
  • 24