Connected vs disconnected application

  • Thread starter Thread starter Nicolae Fieraru
  • Start date Start date
N

Nicolae Fieraru

Hi All,

I read in a book that a program can connect to a database using two
different types of connections to a database. In case the program can
maintain a direct connection, classes such as OleDbConnection, OleDbCommand
and OleDbDataReader can be used.
The other option is to create a disconnected application, using an
OleDbDataSet.
and an OleDbDataAdapter.

I want to populate a ComboBox from a table. I know how to do this only for
disconnected applications. Is it possible to use a connected application to
populate a ComboBox? If I can use any method, which one should I use? How
should I decide which one to preffer among them two?

Regards,
Nicolae
 
I want to populate a ComboBox from a table. I know how to do this only for
disconnected applications. Is it possible to use a connected application
to populate a ComboBox?

Yes -- Here is how --
http://codebetter.com/blogs/sahil.malik/archive/2004/12/11/36078.aspx
If I can use any method, which one should I use? How should I decide which
one to preffer among them two?

Here are my thoughts about connnected vs. disconnected. (SqlDataAdapter is
disconnected and SqlCommand/SqlDataReaders are connected).
http://codebetter.com/blogs/sahil.malik/archive/2005/01/28/48711.aspx

HTH :-)

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 
Nicolae,

With ADONET when you get data or write data there is forever a connection.

When you are reading data, than the connection is there (when you do it
well) as long as the datareader is reading (which is as well used in the
fill from a dataset).

Of course can you populate with the datareader a Combobox using the
items.add in.

However the combobox itself is disconnected.

The contrapart is OleDB what is a connected situation. In OleDB is a
recordset used which is constantly keeping connection with the Database. A
concept that looks nice however has a lot of problems had to be overcome.

Therefore the new direction is choosen, the dataset (not to mix up with the
recordset because it holds relations and datatables where the last you can
compare as disconnected recordsets). A simple example why disconnected,
think on a PDA.

I hope this gives some idea's

Cor
 
Hi Nicolae,

A .NET Framework data provider is used for connecting to a database,
executing commands, and retrieving results. Those results are either processed
directly, or placed in an ADO.NET DataSet in order to be exposed to the user
in an ad-hoc manner, combined with data from multiple sources, or remoted between
tiers.
You can use the Data Reader to populate your Combo Box..A data reader reads a forward-only,
read-only stream of data from a data source.So, incase you don't want any manipulation in the data and
have to read all at once, you should go for Data Reader as it is more economical in terms of load on your
application.
The DataSet object is central to supporting disconnected, distributed data scenarios with ADO.NET.
The DataSet is a memory-resident representation of data that provides a consistent relational programming
model regardless of the data source. It can be used with multiple and differing data sources, used with XML
data, or used to manage data local to the application. The DataSet represents a complete set of data including
related tables, constraints, and relationships among the tables.

An ADO.NET DataSet contains a collection of zero or more tables represented by DataTable objects.
The DataTableCollection contains all the DataTable objects in a DataSet.

So,in cases you want a light weight connection or data from more than one table,DataSet is the option for you.

HTH

Mona
 
Thank you Sahil, I read your blog. I consider the information presented in
there to be useful. I also had a look at the code with the datareader and I
found a few good ideas in there.

Regards,
Nicolae
 
Thank you Mona, you described very well the advantages of using a DataSet.
I managed to fill in the combobox using a datareader as well, but now I've got another problem.
I will post another question.

Regards,
Nicolae

Hi Nicolae,

A .NET Framework data provider is used for connecting to a database,
executing commands, and retrieving results. Those results are either processed
directly, or placed in an ADO.NET DataSet in order to be exposed to the user
in an ad-hoc manner, combined with data from multiple sources, or remoted between
tiers.
You can use the Data Reader to populate your Combo Box..A data reader reads a forward-only,
read-only stream of data from a data source.So, incase you don't want any manipulation in the data and
have to read all at once, you should go for Data Reader as it is more economical in terms of load on your
application.
The DataSet object is central to supporting disconnected, distributed data scenarios with ADO.NET.
The DataSet is a memory-resident representation of data that provides a consistent relational programming
model regardless of the data source. It can be used with multiple and differing data sources, used with XML
data, or used to manage data local to the application. The DataSet represents a complete set of data including
related tables, constraints, and relationships among the tables.

An ADO.NET DataSet contains a collection of zero or more tables represented by DataTable objects.
The DataTableCollection contains all the DataTable objects in a DataSet.

So,in cases you want a light weight connection or data from more than one table,DataSet is the option for you.

HTH

Mona
 
Of course can you populate with the datareader a Combobox using the
items.add in.

Hi Cor. I figured it out in the meantime and this the way I've done it.
However the combobox itself is disconnected.
For me it is ok if the combobox is disconnected.
I hope this gives some ideas

Cor

Thanks for your reply,
Nicolae
 
Back
Top