Dmitri,
It really depends on what you are doing. I, for instance, steer away
from the DataSet object. I usually don't have a need for its features. A
dataset is very useful if you need to have several tables linked together in
a parent/child relationship or in some other fashion. When I need to bind
data, I find that I have a single set of data. If I were to use the dataset
for this, I would be creating an object with more overhead than I need. I
usually have a custom object for every entity that I work with, so I would
just use a datareader from the database to create a collection of these
objects. If your data is very simple, you could just create an array of
strings to which to bind. Bindable controls can bind to any object that has
primitive public properties such as string and int.
Also, in question number 2, you are confusing a web control with an ADO.NET
object. You cannot bind a DataTable with a custom object. A DataTable is a
container object commonly used within a DataSet. A Datagrid can be bound TO
a DataTable or other custom object or simply an array. Check out the SDK
documentation on databinding.
Best regards,
Jeffrey Palermo
"Just D" <no@spam.please> wrote in message
news:yYZMc.11217$BX.10688@lakeread08...
Hi,
If anybody needs to show some data retrieved from the database table, what
method is more preferrable?
1. DataSet ds = ...;
DataGrid.Data.Source.ds;
DataGrid.Bind();
2. Write a custom object, fill it with the DataSet data and ÅÒÕÔ try to
bind the DataGrid or DataTable and this custom object?
I usually don't allow users to change anything irectly in the DataGrid,
but I allow to select a row and then show a set of TextBoxes, DropDown lists
etc. to correct/enter data. Is it a good approach or it's better to allow
userworking with the DataGrid directly and then Update this DataSet or
whatever?
Thanks,
Dmitri