PC Review


Reply
Thread Tools Rate Thread

how to build a DataView ?

 
 
Lloyd Dupont
Guest
Posts: n/a
 
      13th Nov 2003
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 ?


 
Reply With Quote
 
 
 
 
.Net Compact Framework
Guest
Posts: n/a
 
      13th Nov 2003
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
"Lloyd Dupont" <net.galador@ld> wrote in message
news:(E-Mail Removed)...
> 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 ?
>
>



 
Reply With Quote
 
Lloyd Dupont
Guest
Posts: n/a
 
      14th Nov 2003
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 ..

".Net Compact Framework" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
> "Lloyd Dupont" <net.galador@ld> wrote in message
> news:(E-Mail Removed)...
> > 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 ?
> >
> >

>
>



 
Reply With Quote
 
William Ryan
Guest
Posts: n/a
 
      14th Nov 2003
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
"Lloyd Dupont" <net.galador@ld> wrote in message
news:(E-Mail Removed)...
> 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 ?
>
>



 
Reply With Quote
 
Lloyd Dupont
Guest
Posts: n/a
 
      16th Nov 2003
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)


"William Ryan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
> "Lloyd Dupont" <net.galador@ld> wrote in message
> news:(E-Mail Removed)...
> > 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 ?
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorted DataView, but unsorted datalist when bound to the dataview CodeMonkey Microsoft ASP .NET 1 4th Feb 2011 10:55 AM
The Next Build Shall be RTM guys not any other builds unless MS decides to do one more build because of bugs before RTM RC2 build 5477 is the last build before RTM Drew Windows Vista General Discussion 8 13th Oct 2006 12:41 AM
I meant RC2 Build 5744 is the last build unless ms find more bugs before the RTM build and gold version there only make another build if there more bugs and not ready for RTM Drew Windows Vista General Discussion 4 12th Oct 2006 02:17 PM
Is there an easy way to copy a DataView (or even the DataGrid showing the DataView) to the Clipboard? Kevin Brown Microsoft Dot NET 4 5th Jan 2005 09:01 PM
how to build a DataView ? Lloyd Dupont Microsoft ADO .NET 5 10th Feb 2004 08:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:22 PM.