Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2008
    Posts
    186

    Unanswered: SqlCommand.ExecuteReader( CommandBehavior )

    Okay, so the ExecuteReader method allows you to supply a CommandBehavior value

    1) What's the difference between SingleRow and SingleResult. I've yet to find something clear and concise that I can understand

    2) How much of a performance difference does it actually make if you choose SingleResult/SingleRow instead of just executing normally, and only looking at the 1st record in the result set (since you only expect 1 row to be returned)

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    1) did you read this?

    http://msdn.microsoft.com/en-us/libr...dbehavior.aspx

    2) very little difference, if any.

  3. #3
    Join Date
    Jan 2008
    Posts
    186
    Yeah, that's the stuff I read.

    Basically what's the difference between...

    1) The query returns a single result set.

    Versus

    2) The query is expected to return a single row

    In the 2nd, a "single row" means just a single row in a table, but what is meant by "single result set" in the 1st one?

  4. #4
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    here's the guts of a proc that returns multiple result sets:

    select a,b,c from table1
    select d,e from table2

    you would iterate from one set to the next by calling IDataReader.NextResult()

    This is much different from returning a single row. one is multiple rows in multiple result sets, the other is a single row in a single result set.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •