Solved

Using dataview Rowfilter

Posted on 2010-09-01
3
905 Views
Last Modified: 2012-06-21
Hi Guys

I have a 2 column table containing vehicleid's and descriptions.
I wish to filter out a single set of rows using the VehicleId.
The table will typically contain 6 rows per vehicleId and
upwards of 500 distinct vehicles therfore about 3000 rows approx.
The reason the table contains 6 rows per vehicleId is because it contains name/value information pairs about the vehicle.

My question is;
When using the DataView.Rowfilter method
- does setting a primary key column have any effect upon the filter,
i.e. Will it improve the filters speed or is it completely unnecessary ?

Many thanks.
___________
‘Get all vehicles.
‘returns 2 columns: VehicleId, Descr
Dim dt as datatable = GetVehicleData()

‘Create a primary key column.
Dim PriKeyCol() As DataColumn = Nothing
ReDim PriKeyCol(1)

'Sets primary key for the table.
PriKeyCol(0) = dt.Columns.Item("VehicleId")
dt.PrimaryKey = PriKeyCol

dv.RowFilter = String.Concat("VehicleId=", VehicleId)
Dim dtVehicleDetails As DataTable = dv.ToTable

‘Bind dtVehicleDetails to some user interface control.

Before filtering the data typically looks like this:
1, VehicleMakeModel
1, VehicleEngineSize
1, VehicleFuelType
1, VehicleSeatsCapacity
1, VehicleColour
1, VehicleRego

2, VehicleMakeModel
2, VehicleEngineSize
2, VehicleFuelType
2, VehicleSeatsCapacity
2, VehicleColour
2, VehicleRego


 
0
Comment
Question by:kevinr188
3 Comments
 
LVL 15

Accepted Solution

by:
rajeeshmca earned 125 total points
ID: 33583767
Hello kevin,

I dont think having a primary key will increase performance during filter
0
 
LVL 8

Assisted Solution

by:Mohit Vijay
Mohit Vijay earned 125 total points
ID: 33583776
because you are using disconnected Architecture, setting primary key will not impact on filtration.
0
 

Author Comment

by:kevinr188
ID: 33583828
Many thanks Guys.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question