DataSource Memory Usage Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If i connect to my database and select all tables and views. Then I drag a
few differnt tables onto differnt tabs on the same form. I know that the
data isn't bound until the tab header is clicked. Yet is the entire
datasource brougth into ram or just the table (or tables that are in the
view)?

What I'm wondering is if I should create multiple data sources for each
particular form to save memory usage or not?

Thanks,
 
Hi,

When you drag and drop from the data source window to the form designer, a
line of code in Form_Load event handler will be generated by the designer.

// TODO: This line of code loads data into the
'northwindDataSet.Products' table. You can move, or remove it, as needed.
this.productsTableAdapter.Fill(this.northwindDataSet.Products);

This indicates the data is filled to the DataSet at form load time. If you
have multiple tables, multiple sets of these rows will be generated. You
can move these Fills to other places, if you would like to save memory
usage. HTH.

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Greg,

In addition to Kevin, the datasource approach with the wizard gives you a
quick start.

Probably is it better to build your datasets in a way, that it only has the
needed data in memory. (Using the Where clauses).

That gives you beside better use of memory a better way of using the
whatever datalines, but also easier way to avoid concurrency errors.

I hope this helps,

Cor
 
Cor,

That was exactly what I was wondering. I want to keep the memory usage
down. So are you recomending multiple data sources or are you sugesting to
edit the select query and used paramaters? I'm thinking you are suggesting
parameterized queries but wanted to make sure I understood.

Thanks
 
Greg,

You understood what I wrote, but it is up to do what you want,

At the moment I am busy with something that is about one database table.

It use a full datatable with only the fields that I need for the combobox,
the only thing I do with that is fill it and update it internally according
to the other changes. It goes never as update table to the server. I saw
today a bug in this (I will report it). On such a table you can do
acceptchanges as often as you want, often does this than have the effect
that you pass bugs or whatever strange thing..

From that I get what I need in another table with all fields where the
*where* parameter is in this case the selectedvalue. That dataset that I get
I use to work with, to delete from to update from etc.. The delete can of
course easier, but I miss than the simple concurrency checks which is in the
dataadapter etc.

That selection table can of course be more tables if it is a very huge table
to make it the user possible to select in times but not have to go throught
that whole table.

I hope this gives an idea.

However how you do it, it is up to you AdoNet offers you in my idea
thousands of possibilities.

Cor
 
Back
Top