Home All Groups Group Topic Archive Search About
Author
3 Apr 2006 12:52 PM
pinhead
Just a question on performance. I'm building an .Net2 web application.
At present we've got very few users and the web app flies along. All
the data access is performed through a DAL and most of the data is
return through DataTables. All code is in C# and all data access
without exception is in the following style:

<code>
private DataTable myDataTable()
{
        using (SqlConnection conn = new SqlConnection(mySQLConnection))
        {
            DataTable dt = new DataTable();
            SqlCommand cmd = new SqlCommand(mySp, conn);
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cmd;
            da.Fill(dt);
            return dt;
            }
}
</code>

Is this preferable over using DataSets? Or would I be better off using
DataReaders?

Author
3 Apr 2006 1:00 PM
Marina Levit [MVP]
A DataSet is just a collection of DataTables.  So when you are using a
dataset, you are really using the tables in it.

Having just a datatable is going to be less overhead then a dataset, since a
dataset includes datatables. However, this overhead is minor, and should not
be a factor.

So, if you don't need the functionality of a dataset, then go ahead and use
a datatable.

Show quote
"pinhead" <dlynes2***@gmail.com> wrote in message
news:1144068761.073641.247810@u72g2000cwu.googlegroups.com...
> Just a question on performance. I'm building an .Net2 web application.
> At present we've got very few users and the web app flies along. All
> the data access is performed through a DAL and most of the data is
> return through DataTables. All code is in C# and all data access
> without exception is in the following style:
>
> <code>
> private DataTable myDataTable()
> {
>        using (SqlConnection conn = new SqlConnection(mySQLConnection))
>        {
>            DataTable dt = new DataTable();
>            SqlCommand cmd = new SqlCommand(mySp, conn);
>            cmd.CommandType = CommandType.StoredProcedure;
>            SqlDataAdapter da = new SqlDataAdapter();
>            da.SelectCommand = cmd;
>            da.Fill(dt);
>            return dt;
>            }
> }
> </code>
>
> Is this preferable over using DataSets? Or would I be better off using
> DataReaders?
>
Author
3 Apr 2006 1:25 PM
Cor Ligthert [MVP]
Marina,

Can you have a look in the newsgroup languages.VB there is a typical
question for you.

Foreign languages names

Cor

Show quote
"Marina Levit [MVP]" <someone@nospam.com> schreef in bericht
news:eE8yT6xVGHA.5468@TK2MSFTNGP14.phx.gbl...
>A DataSet is just a collection of DataTables.  So when you are using a
>dataset, you are really using the tables in it.
>
> Having just a datatable is going to be less overhead then a dataset, since
> a dataset includes datatables. However, this overhead is minor, and should
> not be a factor.
>
> So, if you don't need the functionality of a dataset, then go ahead and
> use a datatable.
>
> "pinhead" <dlynes2***@gmail.com> wrote in message
> news:1144068761.073641.247810@u72g2000cwu.googlegroups.com...
>> Just a question on performance. I'm building an .Net2 web application.
>> At present we've got very few users and the web app flies along. All
>> the data access is performed through a DAL and most of the data is
>> return through DataTables. All code is in C# and all data access
>> without exception is in the following style:
>>
>> <code>
>> private DataTable myDataTable()
>> {
>>        using (SqlConnection conn = new SqlConnection(mySQLConnection))
>>        {
>>            DataTable dt = new DataTable();
>>            SqlCommand cmd = new SqlCommand(mySp, conn);
>>            cmd.CommandType = CommandType.StoredProcedure;
>>            SqlDataAdapter da = new SqlDataAdapter();
>>            da.SelectCommand = cmd;
>>            da.Fill(dt);
>>            return dt;
>>            }
>> }
>> </code>
>>
>> Is this preferable over using DataSets? Or would I be better off using
>> DataReaders?
>>
>
>
Author
3 Apr 2006 1:52 PM
Marina Levit [MVP]
I did answer him the best I could, though I'm not sure I was much help. I'm
Russian, but been in the US since childhood...

Thanks for thinking of me :)

Show quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:ewo6iHyVGHA.1868@TK2MSFTNGP09.phx.gbl...
> Marina,
>
> Can you have a look in the newsgroup languages.VB there is a typical
> question for you.
>
> Foreign languages names
>
> Cor
>
> "Marina Levit [MVP]" <someone@nospam.com> schreef in bericht
> news:eE8yT6xVGHA.5468@TK2MSFTNGP14.phx.gbl...
>>A DataSet is just a collection of DataTables.  So when you are using a
>>dataset, you are really using the tables in it.
>>
>> Having just a datatable is going to be less overhead then a dataset,
>> since a dataset includes datatables. However, this overhead is minor, and
>> should not be a factor.
>>
>> So, if you don't need the functionality of a dataset, then go ahead and
>> use a datatable.
>>
>> "pinhead" <dlynes2***@gmail.com> wrote in message
>> news:1144068761.073641.247810@u72g2000cwu.googlegroups.com...
>>> Just a question on performance. I'm building an .Net2 web application.
>>> At present we've got very few users and the web app flies along. All
>>> the data access is performed through a DAL and most of the data is
>>> return through DataTables. All code is in C# and all data access
>>> without exception is in the following style:
>>>
>>> <code>
>>> private DataTable myDataTable()
>>> {
>>>        using (SqlConnection conn = new SqlConnection(mySQLConnection))
>>>        {
>>>            DataTable dt = new DataTable();
>>>            SqlCommand cmd = new SqlCommand(mySp, conn);
>>>            cmd.CommandType = CommandType.StoredProcedure;
>>>            SqlDataAdapter da = new SqlDataAdapter();
>>>            da.SelectCommand = cmd;
>>>            da.Fill(dt);
>>>            return dt;
>>>            }
>>> }
>>> </code>
>>>
>>> Is this preferable over using DataSets? Or would I be better off using
>>> DataReaders?
>>>
>>
>>
>
>
Author
3 Apr 2006 1:32 PM
Cor Ligthert [MVP]
Pinhead,

In addition for the rest on the answer from Marina.

> Is this preferable over using DataSets? Or would I be better off using
> DataReaders?
>
The dataset/datatable use the datareader as what Marina wrote for DataTable
instead of DataSet is as well for this

However, have a look to this. There is more written about yor question on
MSDN

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/datasetenhance.aspI hope this helps,Cor

AddThis Social Bookmark Button