Groups | Blog | Home
all groups > dotnet datatools > august 2005 >

dotnet datatools : Get column names



kk
8/12/2005 6:04:41 AM
Is there an easy way to poulate a combo box with a table's column names from
a dataset?
Mona
8/16/2005 12:00:00 AM
Hi,

Regarding this issue of populating a combo box with the column names from a
dataset, We need to use a DataAdapter. DataAdapters are the objects that
handle communication between the database itself and your in-memory DataSet.

We use this DataAdapter to 'Fill()' the DataSet with the results of our
SELECT statement. We don't need the database anymore, the second parameter
of the Fill() method specifies what to call the new in-memory table. We need
to Close() the Connection to the database once the Fill() is done.

With the data in memory, we no longer need the database. DataSets can
contain whole databases, so to populate the combo-box we explicitly specify
the DataTable object . We use this DataTable object to populate the
combo-box.

Hope this helps.

Regards,
Mona [Grapecity]

[quoted text, click to view]

AddThis Social Bookmark Button