473,432 Members | 1,659 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,432 software developers and data experts.

Creating Dataview limited to certain columns from datatable

Normally Google is my friend, but I can't seem to work this one out. I'm
sure it's really simple as well.

I normally create a dataview from a table within a dataset using the
..defaultdataview method of the table (eg dv=ds.tables(0).defaultdataview)

I want to create a dataview that is limited to only certain columns of the
datatable.

Anybody got a quick example to get me going?

Thanks in advance
Simon
Nov 23 '05 #1
4 4820
Have you tried using the RowFilter method of the dataview to limit the data
after the fact?

"Simon Verona" <no****@nomail.zzz> wrote in message
news:Oc**************@tk2msftngp13.phx.gbl...
Normally Google is my friend, but I can't seem to work this one out. I'm
sure it's really simple as well.

I normally create a dataview from a table within a dataset using the
.defaultdataview method of the table (eg dv=ds.tables(0).defaultdataview)

I want to create a dataview that is limited to only certain columns of the
datatable.

Anybody got a quick example to get me going?

Thanks in advance
Simon

Nov 23 '05 #2
Simon Verona wrote:
Normally Google is my friend, but I can't seem to work this one out. I'm
sure it's really simple as well.

I normally create a dataview from a table within a dataset using the
.defaultdataview method of the table (eg dv=ds.tables(0).defaultdataview)

I want to create a dataview that is limited to only certain columns of the
datatable.

Anybody got a quick example to get me going?

Thanks in advance
Simon


I guess my question is why you want to do this?

The dataview is just a filtered view of the table. It limits what rows
you see. Whatever you are using to display the data (datagrid?) should
be limiting the number of columns you see. The data is not copied when
you use a dataview, it is still pointing to the same datatable and
therefore needs the same structure.

Chris
Nov 23 '05 #3
Simon,

It is as Chris write, however I have seen this question more, therefore I am
curious why you ask this?

(You can hide a column of a datatable with the columnmapping, however it is
than for all dataviews)

Cor
Nov 23 '05 #4
You are correct, I can alter the display using the datagrid that I'm using
(it's actually Component One's truedbgrid that I'm using).

Just was thinking that it might be easier and quicker to remove the column
from the dataview that I'm creating - this is a view only grid so there will
be no updating/deleting etc.

I found the columnmapping property and I'm experimenting with that,
otherwise I'll choose the columns on the datagrid itself.

Thanks for the thoughts
Simon
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Simon,

It is as Chris write, however I have seen this question more, therefore I
am curious why you ask this?

(You can hide a column of a datatable with the columnmapping, however it
is than for all dataviews)

Cor

Nov 23 '05 #5

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

Similar topics

3
by: John Smith | last post by:
Hey folks, I have a Global DataSet which I use across my application. I use a DataView to give me the data that I want in a certain instance. Is there a way I can create the DataView so that...
1
by: Phil Townsend | last post by:
I have a dataview that is generated from a dataset which gets its data from an xml file. I would like to use the dataview to include only certain columns in the result set. The xml file contains 7...
6
by: Alpha | last post by:
I have a listbox with datasource from a dataview. When a user selects a different item in a combobox then I need to refresh the listbox to the appropriate listing based on that combobox's selected...
8
by: Dave Hagerich | last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being displayed, using the following code as a test: DataView theView = new DataView(theDataSet.Tables); theView.RowFilter =...
13
by: Steve | last post by:
I have a form with a dataset and a datagrid. I created a dataview on this dataset. When the user modifies the datagrid, I look up this record in the dataview to make sure it is unique. Here is...
5
by: David Wender | last post by:
I want to create a dataview with a sort on multiple columns. However, when I use FindRows, I only want to search some of the columns, not all. Is this possible? I have not been able to make it...
0
by: Nathan Franklin | last post by:
Hello Guys, I have been trying to work this our for so long, but I just can't seem to find the answer. I am loading a datatable from a an access database using an oledbdataadapter. I then...
6
by: Nick | last post by:
I have a code that returns data in IList. My webGrid doesn't allow me to sort with IList returned, it say it only suports DataView, DataTable and DataSet, not IEnumerable. I don't know how to...
3
by: hzgt9b | last post by:
Using VS2005, VB.NET, I know that I can use a DataView to constrain what rows are "seen" from the underlying datatable - is it also possible to use a DataView to constrain what columns/attributes...
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
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
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...
1
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.