|
Home > Archive > MS SQL Server > July 2005 > Which is better?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Patrick 2005-07-18, 7:23 am |
| I want a stored procedure for retrieving one row of data to be executed from
an ASP.NET user control. using the Microsoft Data Application Block EDRA.
Which is a better stored procedure in terms of performance and good practice:
1) A SP that returns a DataSet with 1 DataTable and 1 DataRow, with the .NET
code having to retrieve the columns
2) a SP that returns out parameters, and the .NET code having to retrieve
the OUT parameter values.
| |
| Rick Sawtell 2005-07-18, 7:23 am |
|
"Patrick" <questions@newsgroup.nospam> wrote in message
news:EA660230-F4F0-4755-BA5E- BFC346FBA793@microso
ft.com...
> I want a stored procedure for retrieving one row of data to be executed
from
> an ASP.NET user control. using the Microsoft Data Application Block EDRA.
>
> Which is a better stored procedure in terms of performance and good
practice:
> 1) A SP that returns a DataSet with 1 DataTable and 1 DataRow, with the
..NET
> code having to retrieve the columns
> 2) a SP that returns out parameters, and the .NET code having to retrieve
> the OUT parameter values.
A stored proc that returns the set that you are looking for. On the .NET
side, using a datareader is going to be the fastest. Unless you need all of
the additional overhead of a dataset, don't use it. The dataset itself
will use a datareader internally to load the data.
Rick Sawtell
| |
| David Browne 2005-07-18, 11:23 am |
| "Patrick" <questions@newsgroup.nospam> wrote in message
news:EA660230-F4F0-4755-BA5E- BFC346FBA793@microso
ft.com...
>I want a stored procedure for retrieving one row of data to be executed
>from
> an ASP.NET user control. using the Microsoft Data Application Block EDRA.
>
> Which is a better stored procedure in terms of performance and good
> practice:
> 1) A SP that returns a DataSet with 1 DataTable and 1 DataRow, with the
> .NET
> code having to retrieve the columns
> 2) a SP that returns out parameters, and the .NET code having to retrieve
> the OUT parameter values.
OUT parameters are much cheaper than result sets.
David
| |
| David Gugick 2005-07-18, 1:23 pm |
| Patrick wrote:
> I want a stored procedure for retrieving one row of data to be
> executed from an ASP.NET user control. using the Microsoft Data
> Application Block EDRA.
>
> Which is a better stored procedure in terms of performance and good
> practice: 1) A SP that returns a DataSet with 1 DataTable and 1
> DataRow, with the .NET code having to retrieve the columns
> 2) a SP that returns out parameters, and the .NET code having to
> retrieve the OUT parameter values.
Better to worse:
OUTPUT parameters using ExecuteNonQuery
ExecuteScalar
ExecuteReader
Anything related to a DataTable
--
David Gugick
Quest Software
www.imceda.com
www.quest.com
|
|
|
|
|