DataTable performance

P

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?
 
M

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.
 
C

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
 
C

Cor Ligthert [MVP]

M

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top