Groups | Blog | Home
all groups > dotnet sdk > november 2003 >

dotnet sdk : how to build a DataView ?


.Net Compact Framework
11/13/2003 6:10:49 PM
if the result set is already in a DataTable object then all you need to do
is
DataView dv = new DataView("dbTable");
Now you can access any of the available methods
dv.Sort("column to sort ASC")
etc ...

if the result set is a DataRow
DataRow dtRow = dbTable.NewRow();
dtRow["field1"] = value
dbTable.Rows.Add(dtRow);

Once this is complete create the DataView
[quoted text, click to view]

William Ryan
11/14/2003 2:37:48 AM
DataTable has a .Select method that may get you what you want. When you say
that you aren't using a RowFilter, is that a necessary thing? Rowfilters
seem made to order for what you want to do. There are many ways to get what
you want, but it depends on knowng what is the ultimate goal. You can use a
DataSet.GetChanges and then set its filter for things like Added, Modified
etc if this is what you want.

You can create a DataView off of ANY datatable, so there's most likely no
need to create a seperate table.. you can use the filter on the primary
table. But if you need to, you can create a second table and then a view,
and then filter it from there.

Let me know what you want to do...I can be of more help.

Cheers,

bill
[quoted text, click to view]

Lloyd Dupont
11/14/2003 9:40:46 AM
I have a program manipulating DataTable and doing search in it
and returning a subset of them ...
moreover I don't use row filter but do the search 'manually'
is there a way I could create my DataView manually from this resul set ?

Lloyd Dupont
11/14/2003 11:26:24 AM
mmhh..
you mean create a new DataTable with my DataRows and use the DataView of
this DataTable ?
mmhh.. that's an idea !

but I have one concern with it.
when I will add my (founded) DataRow to this new DataTable, don't I remove
them from their original DataTable ?

I think so....
anyway my find set should be small, so I might afford copying the data ...
mmhh....
that's a good lead ..

[quoted text, click to view]

Lloyd Dupont
11/17/2003 8:25:28 AM
in fact I realize that I could have a dataview as my data are just selected
with a criteria like column X equals Y

anwyay I found that the building of DataView through RowFilter to be slow.
I need to build DataView on user clic, and found that, even in a small
DataTable, it took a noticeable time (or maybe it was for my editor control
to appear, I don't know) so I was thinking to do the search myself (I know
the column type, I don't have to parse a string)


[quoted text, click to view]

AddThis Social Bookmark Button