Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo  
 
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



Posted by Xander Zelders



 
Previous Posts
    - Trying to get subset of data in a grid
    - Serializing System.Version type
    - Array problem
    - Create Folder Share In VB.NET Without Using WMI
    - Rich text column in datagrid
    - Exception properties
    - How to include a C# class in VB.net?
    - Datagrid events
    - Spam filter
    - Trying to use PrintForm method

Archives
    - 10/03/2004 - 10/10/2004
    - 10/10/2004 - 10/17/2004
    - 10/17/2004 - 10/24/2004
    - 10/24/2004 - 10/31/2004
    - 10/31/2004 - 11/07/2004
    - 11/21/2004 - 11/28/2004
    - 11/28/2004 - 12/05/2004
    - 12/05/2004 - 12/12/2004
    - 12/12/2004 - 12/19/2004
    - 12/19/2004 - 12/26/2004
    - 12/26/2004 - 01/02/2005
    - 01/23/2005 - 01/30/2005
    - 01/01/2006 - 01/08/2006
    - 09/24/2006 - 10/01/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland