Solved

Using dataview Rowfilter

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Host asp.net pages 5 25
Export import database 4 43
Get the selected ValueMember of Combobox 5 21
Crystal reports vb.net 2 16
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
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…

895 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

14 Experts available now in Live!

Get 1:1 Help Now