Solved

Using dataview Rowfilter

Posted on 2010-09-01
3
902 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
Comment Utility
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
Comment Utility
because you are using disconnected Architecture, setting primary key will not impact on filtration.
0
 

Author Comment

by:kevinr188
Comment Utility
Many thanks Guys.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now