William Vaughn
5/8/2008 11:22:00 PM
ExecuteScalar will not help performance over ExecuteReader in this case.
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
"Cor Ligthert[MVP]" <notmyfirstname@planet.nl> wrote in message
news:C178481C-0FE0-47E5-8153-262AE8600C13@microsoft.com...
> William,
>
> With your answer I can get the idea (as I did not know better) that you
> want to say that there are situatons that the Scalar can be used instead
> of a reader to get full rows.
>
>>ExecuteScalar won't help much.
> In my idea it won't help at all,
>
> I cannot have the idea that that was the goal of your reply.
>
> Cor
>
> "William Vaughn [MVP]" <billvaNoSPAM@betav.com> schreef in bericht
> news:9EF83503-4728-4C2F-81C6-16B786321E4C@microsoft.com...
>> Scott is right. But consider that the efficiency lies in the question you
>> ask--the query. If it returns 100 rows and you only want the first row or
>> the first column of the first row, ExecuteScalar won't help much. That's
>> because ADO.NET has to return all 100 rows before determining that there
>> is not another resultset to process. To make this faster, get the SELECT
>> to return a single value or better yet (and even faster) use the RETURN
>> value to capture the value (if it's an INT) or an OUTPUT parameter.
>>
>> --
>> __________________________________________________________________________
>> William R. Vaughn
>> President and Founder Beta V Corporation
>> Author, Mentor, Dad, Grandpa
>> Microsoft MVP
>> (425) 556-9205 (Pacific time)
>> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
>> ____________________________________________________________________________________________
>> "Scott M." <smar@nospam.nospam> wrote in message
>> news:%23OHxX68rIHA.2064@TK2MSFTNGP05.phx.gbl...
>>> Scalar only gives you back the first field from the first record, so if
>>> you want the whole record, don't use scalar.
>>>
>>> Scalar is generally good for when you are calling a user function in the
>>> DB to get back a single result.
>>>
>>> -Scott
>>>
>>>
>>> "John" <info@nospam.infovis.co.uk> wrote in message
>>> news:O6C3tM8rIHA.4376@TK2MSFTNGP06.phx.gbl...
>>>> Hi
>>>>
>>>> Is there any advantage of using scalar execution method for data
>>>> adapter if the result is going to be a single record?
>>>>
>>>> Thanks
>>>>
>>>> Regards
>>>>
>>>
>>>
>>
>