Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using dataview Rowfilter

Posted on 2010-09-01
3
Medium Priority
?
909 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Accepted Solution

by:
rajeeshmca earned 500 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 500 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

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…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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