Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / November 2003

Tip: Looking for answers? Try searching our database.

how to build a DataView ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lloyd Dupont - 13 Nov 2003 22:40 GMT
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 ?
.Net Compact Framework - 13 Nov 2003 23:10 GMT
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
> 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 - 14 Nov 2003 00:26 GMT
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 ..

> if the result set is already in a DataTable object then all you need to do
> is
[quoted text clipped - 13 lines]
> > 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 ?
William Ryan - 14 Nov 2003 07:37 GMT
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
> 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 - 16 Nov 2003 21:25 GMT
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)

> 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
[quoted text clipped - 17 lines]
> > 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 ?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.