Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hy, i'm working on a application where i use dataset and tableadapter for the connection with my database.
My question is where it is recomended to make fill on the table adapter?
for example:
this.tableAdapter(this.dataset.table)
Where?In the constructor after InitializeComponent()?or in the Load event of the form?
Thank you.
Posted

Read about ADO.NET here and it will help you.

Look at these:
MSDN: ADO.NET[^]
MSDN: Accessing Data with ADO.NET[^]

The C# Station ADO.NET Tutorial[^]
Using ADO.NET for beginners[^]

In the constructor after InitializeComponent()?or in the Load event of the form?
When you need it. Generally during load.
 
Share this answer
 
v2
Comments
Albin Abel 28-Apr-11 11:43am    
Good links and reusable answer. :) 5
Sandeep Mewara 28-Apr-11 11:44am    
:)
Simply whenever you need the data, fill it. No need to fill when you are not going to use the data. Adapter simply call some sql queries and populate the result to a data holder like dataset. The beauty of the adapter is it simply encapsulate and abstract things which you manually do with a data reader. Provider specific adapters are there which work on specific data providers, so that the dataset doesn't worry about who are the data provider whether Sql server or MySql.

Forgot to add...Don't use table adapters (in typed dataset) if your dataset holds more than one table. Table adapters having known bugs. Instead use the common dataadapter.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900