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?

Re: DataTable performance by Marina

Marina
Mon Apr 03 08:00:24 CDT 2006

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" <dlynes2005@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?
>



OT by Cor

Cor
Mon Apr 03 08:25:48 CDT 2006

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" <dlynes2005@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?
>>
>
>



Re: DataTable performance by Cor

Cor
Mon Apr 03 08:32:28 CDT 2006

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


Re: OT by Marina

Marina
Mon Apr 03 08:52:23 CDT 2006

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 :)

"Cor Ligthert [MVP]" <notmyfirstname@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" <dlynes2005@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?
>>>
>>
>>
>
>