Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dataview not taking effect

Status
Not open for further replies.

jwarmuth

IS-IT--Management
Joined
Sep 22, 2001
Messages
151
Location
CA
My first time working with dataviews and as usual it's not going exactly as documented!

I'm trying to perform and extremely simple filter on a dataset I've populated from my SQL DB.

The row filter is dynamically created when the user selects an option from a drop down listbox, hence the building of the filter string (matches the selected listbox index to a corresponding datatable value).

Code:
            strFilterBy = "Manufacturer = '" & DsManufList1.Tables(0).Rows(shtSelected).Item(0) & "'"
            DsSoftwareList1.Tables("Software").DefaultView.RowFilter = strFilterBy

Anyhoo... this produces a row filter equal to;

Manufacturer = 'AutoDesk' (although 'AutoDesk' could be whatever)

question is, how can I get that filter to take effect, as it's not with that syntax. :)

TIA!

Jeff W.
MCSE, CNE
 
You need to assign the returned dataview to something.
Code:
dim dvFiltered as dataview

dvFiltered = dsSoftwareList1.Tables("Software").DefaultView.RowFilter = strFilterBy

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
ROFLE! I found the problem, thanks to your help Rick;

Code:
Dim dv As New DataView(DsSoftwareList1.Tables("Software"))
            dv.RowFilter = strFilterBy
            
            DataGrid1.DataSource = dv

One needs to bind the dataview, not the dataset (which the dataview is bound) to the contol (in this case a simple datagrid). This is where I was having the problem.

Thanks for the help. :)

Jeff W.
MCSE, CNE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top