Help with filtering data in a table

Hi,

This is a follow up to the following case:

http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_27827475.html#a38307414

when NSN_ID in my  linkssadb file contains the same data (listed below), I receive 4 rows from LinkAID = 1 and LinkAID = 2 in my list box instead of only for data for LinkAID = 1. Is there a way to filter by LinkAID instead of NSN_ID?

I tried changing the filter from  NSN_ID to LinkAID:

MsgBox("keyNsn" & keyNsn)
        Dim _table As DataView = dtMaster.DefaultView
        _table.RowFilter = "LinkAID in (" & keyNsn & ")"
        C1NSN.DataSource = _table
        C1NSN.DataTextField = "NSN"
        C1NSN.DataValueField = "NSN_ID"
        C1NSN.DataBind()

but it does not work.


Linkssadb.xml

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Root>
  <LinkA>
    <LinkAID>0</LinkAID>
    <Fuze_ID>0</Fuze_ID>
    <NSN_ID>0</NSN_ID>
  </LinkA>
  <LinkA>
    <LinkAID>1</LinkAID>
    <Fuze_ID>1</Fuze_ID>
    <NSN_ID>1,2</NSN_ID>
  </LinkA>
  <LinkA>
    <LinkAID>2</LinkAID>
    <Fuze_ID>1</Fuze_ID>
    <NSN_ID>1,2</NSN_ID>
  </LinkA>
</Root>
vcharlesAsked:
Who is Participating?
 
Rajar AhmedConnect With a Mentor ConsultantCommented:
Just change these lines ,  it will work for u .
 For Each xnNSN As Xml.XmlNode In xdNSN.SelectNodes("/Root/NSNTable[contains('," & NSNID & ",', concat(',', NSN_ID, ','))]") 'NSN.xml
                NSNID2 = xnNSN.SelectSingleNode("NSN_ID").InnerText
                If dtMaster.Select("NSN_ID in (" & NSNID2 & ")").Length = 0 Then
                    Name = xnNSN.SelectSingleNode("NSN").InnerText
                    dtMaster.Rows.Add({fuze_Nsn_id, LinkAID, NSNID2, Name})
                End If
            Next

Open in new window

0
 
vcharlesAuthor Commented:
Hi,

As an alternate solution, how do you also avoid duplicate rows in a listbox?

V.
0
 
vcharlesAuthor Commented:
It works!

Thanks!

Victor
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.