473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DataTable vs DataView

I'm new to VB.NET and just gettng into database "Learning." How do I decide
if I need a DataTable or a DataView.

Thanks...

Bruce
Nov 21 '05 #1
4 15074
Hi,

A dataview is a customized view of a datatable that supports
filtering, sorting, and searching.

http://msdn.microsoft.com/library/de...classtopic.asp
Ken
---------------------
"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I'm new to VB.NET and just gettng into database "Learning." How do I decide
if I need a DataTable or a DataView.

Thanks...

Bruce

Nov 21 '05 #2

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
Hi,

A dataview is a customized view of a datatable that supports
filtering, sorting, and searching.

http://msdn.microsoft.com/library/de...classtopic.asp

Ken
---------------------
"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I'm new to VB.NET and just gettng into database "Learning." How do I decide if I need a DataTable or a DataView.

Thanks...

Bruce


So, if I'm using a datagrid and only want to display and edit the data, I
use a DataTable which I created from my DataAdaptor. If I want to filter,
sort or search my data, I need to use a DataView.

Is my understanding correct?

Bruce
Nov 21 '05 #3
Bruce,

When you use a windowforms datagrid you can better or always use a dataview
or the in the datatable build in dataview what is the datatable.defaultview

The sort by the user in the datagrid is reflected in the
defaultview/dataview.

To get the rows you can than use the bindingmanagerbase.position

http://msdn.microsoft.com/library/de...itiontopic.asp

I hope this helps?

Cor
Nov 21 '05 #4
Bruce A. Julseth wrote:
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eq**************@tk2msftngp13.phx.gbl...
Hi,

A dataview is a customized view of a datatable that supports
filtering, sorting, and searching.


http://msdn.microsoft.com/library/de...classtopic.asp

Ken
---------------------
"Bruce A. Julseth" <br***********@attglobal.net> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl.. .
I'm new to VB.NET and just gettng into database "Learning." How do I


decide
if I need a DataTable or a DataView.

Thanks...

Bruce

So, if I'm using a datagrid and only want to display and edit the data, I
use a DataTable which I created from my DataAdaptor. If I want to filter,
sort or search my data, I need to use a DataView.

Is my understanding correct?

Bruce

Another way to say what Cor posted is:

All datatables have a default dataview. When you bind a datatable to a
windows form datagrid you are actually binding to the datatables default
dataview.

datagrid.datasource = datatable
datagrid.datasource = datatable.defaultview

The above two statements result the same.

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Brian Bischof | last post by:
I'm using a third-party tool that takes a DataTable as a parameter. I really need to pass it a DataView instead. When I try to explicitly cast the DataView as a DataTable I get an error that they...
1
by: TaeHo Yoo | last post by:
Hi all, After sorting and grouping data using a dataview, then how to transfer the changed datatable in the dataview to a datatable in C#? Cheers
5
by: Richard | last post by:
Windows Forms, csharp, 20 rows in DataTable 14 shown in view after filter applied. For any of the 14 how do I do the datarow or something else thing to access the data in the row of the table...
4
by: Kris Rudin | last post by:
I am displaying a table of information on a web page, using an asp:table that I populate dynamically. On this page I give the user the options to group the rows by certain fields, and/or filter the...
5
by: Ron L | last post by:
I have a DataTable that is being maintained in a Model class. I also have a View class which creates a DataView from the DataTable that the Model passes it. The view class then has methods to...
3
by: Rich | last post by:
Hello, I am populating a datagridview from a datatable and filtering the number of rows with a dataview object. Is there a way to retrieve the rows displayed by the datagridview into a separate...
6
by: David P. Donahue | last post by:
I've been looking around for ways to sort the rows in a DataTable, and everything seems to point to just changing the Sort property on that DataTable's DefaultView property. That's all well and...
2
by: am72de | last post by:
Hi all, I have a problem with the DataTable.Reset(). After resetting the DataTable the count of the DataView is no longer equal with the DataTable.Rows.Count, so the second Assert fails. ...
1
by: Ronald S. Cook | last post by:
If I add a row to a DataView, will the row automatically be added to the underlying DataTable? If so, I'm trying to understand why anyone would add a row to a DataView when they may as well just...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.