DataGrid
(Monday, December 13, 2004)
Found the following interesting discussion in the Newsgroups:
DataGrid by:Nabu
| I have built a customized ADO recordset. I would like to put the data into a data grid, but the OleDbDataAdapter fill method wants a table name. Is there a way to put a customized recordset into a data grid without using a table name? or is there a default table name give to the recordset?
Code: Dim objWMIPatchState As clsWMIPatchState
Dim dsPatchState As DataSet = New DataSet("recordset")
Dim da As OleDbDataAdapter = New OleDbDataAdapter
objWMIPatchState = New clsWMIPatchState("playground")
da.Fill(dsPatchState, objWMIPatchState.WMIPatch) <== error here
dtgOutput.DataSource = da
| | | Reply: by:Ken Tucker [MVP]
| | | Hi,
You can bind the datagrid to an arraylist or collection filled with your clsWMIPatchState. Any properties in the class will be shown in the grid.
Ken
| | | Reply: by:Cor Ligthert
| | | Hi Nabu,
In addition to Ken.
When you want to use a recordset for a datagrid, you should first convert it to a dataset. For that you can use a special method Fill from the dataadapter.
(And than the recordset is not usable for an update, therefore the only good advice can be in my opinion to see what the dataset direct can do for you. It is also more easy to customize than a recordset).
A dataset is a container which holds more datatables.
I hope this helps a little bit?
Cor
|
|
0 Comments:
Post a Comment