Solved

Using dataview Rowfilter

Posted on 2010-09-01
3
906 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 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.Net  Exporting Excel Woorkbook to PDF 7 68
Set arraylist as datatable 2 26
Can Selenium do Load Testing? 2 56
VB .net 2010 Byte array 2 16
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 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