473,406 Members | 2,698 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,406 software developers and data experts.

DataTable and DataView

Hello,

I have:

BindingManagerBase bm;

DataTable myTable;

DataView myDataView

DataGrid myGrid;

myDataView = myTable["tab"] // data in table exist

myDataView.Sort = "field1";

myGrid.DataSource = myDataView;

bm = this.BindingContext[myDataView];

the data order in DataView and DataTable is different.

How can a read (change) the data in table using DataView?

Any idea?

Thanks a lot,

Ruslan
Nov 15 '05 #1
3 6411
Hi,

The myDataView.Sort = "field1" causes the DataView to present the data
sorted by 'field1' presumably the data in the DataTable is either unsorted
or it is sorted on a different field.

Hope this helps

Chris Taylor
"Ruslan" <ru*********@hotmail.com> wrote in message
news:uY**************@tk2msftngp13.phx.gbl...
Hello,

I have:

BindingManagerBase bm;

DataTable myTable;

DataView myDataView

DataGrid myGrid;

myDataView = myTable["tab"] // data in table exist

myDataView.Sort = "field1";

myGrid.DataSource = myDataView;

bm = this.BindingContext[myDataView];

the data order in DataView and DataTable is different.

How can a read (change) the data in table using DataView?

Any idea?

Thanks a lot,

Ruslan

Nov 15 '05 #2
Chris and Ruslan,

Additionally, you can change the data by modifying the DataRowView that
is returned from the indexer on the DataView. The view is nothing more than
a way of viewing the underlying data, and you should be able to set the
values on the view like you would a table (as the view points to the
underlying table/row ultimately).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Chris Taylor" <ch*************@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
Hi,

The myDataView.Sort = "field1" causes the DataView to present the data
sorted by 'field1' presumably the data in the DataTable is either unsorted
or it is sorted on a different field.

Hope this helps

Chris Taylor
"Ruslan" <ru*********@hotmail.com> wrote in message
news:uY**************@tk2msftngp13.phx.gbl...
Hello,

I have:

BindingManagerBase bm;

DataTable myTable;

DataView myDataView

DataGrid myGrid;

myDataView = myTable["tab"] // data in table exist

myDataView.Sort = "field1";

myGrid.DataSource = myDataView;

bm = this.BindingContext[myDataView];

the data order in DataView and DataTable is different.

How can a read (change) the data in table using DataView?

Any idea?

Thanks a lot,

Ruslan


Nov 15 '05 #3
Cor
Hi Ruslan,
I think that you would have to bind the dataview to a control which makes it
you possible to change and enter the data.

Otherwise your dataview is almost without sence.

If you don't do that, you do'nt need the dataview but can direct change the
dataset by changing the values with something like

dataset.table(0).rows()(item) = "Ruslan" 'asuming it is a string

I hope this helps a little bit.

Cor
Nov 15 '05 #4

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...
4
by: Bruce A. Julseth | last post by:
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.