I am trying to search a dataset I have populated from several XML files for certain words in each column. The dataset table is "item" and the columns I want searched is "descritption". "description" are several articles from an rss feed. I want to search the articles for sports players names. For example in the article
"Jimmy Graham returns to a limited practice - Jimmy Graham | NO" I would like to search for "Jimmy Graham" and once found I want the entire article description to be displayed in a listbox. I am essentially searching for player names which the user enters in another listbox (addteamform.addplayerlistbox) for articles containing that player name, then displaying them in another listbox (mainform.articlelistbox). here is my code I am using to try to search the dataset/dataview for a specific name in an article. I am sure the code is all wrong for what I'm trying to do...

 Public Shared Sub searchPlayers()
        MainForm.articleListBox.DataBindings.Clear()

        Dim ds As DataSet = New DataSet

        ds.ReadXml("http://www.rotoworld.com/rss/feed.aspx?sport=nfl&ftype=news&count=12&format=rss")
        ds.ReadXml("")
        ds.ReadXml("http://www.fantasyfootballstarters.com/podcast.xml")
        ds.ReadXml("")
        ds.ReadXml("")
        ds.ReadXml("http://sports.yahoo.com/nfl/rss.xml")
        ds.ReadXml("http://feeds2.feedburner.com/fantasyfootballcom")

        Dim dv As New DataView
        dv.Table = ds.Tables("item")
        Dim drv As DataRowView 'Data Row View object to query DataView object

        'Filter based on a listbox value selected
        dv.RowFilter = "title" & CInt(addTeamForm.playerListBox.SelectedItem)

        'Retrieve my values returned in the result
        For Each drv In dv
            MainForm.articleListBox.Items.Add("title")
        Next





    End Sub

Dani AI

Generated

— short, practical fix and a couple of safer options (and a note on 's scraping idea).

For RSS feeds prefer a syndication parser instead of fragile screen-scraping; the .NET Syndication types give you a consistent item model (Title, Summary/Content, Links) you can read and then search. See the SyndicationFeed docs for examples. (learn.microsoft.com)

A simple, robust approach is: load your feeds into a DataTable (or into SyndicationFeed.Items), then loop rows and use a case-insensitive IndexOf check on the description. That avoids RowFilter escaping headaches and gives you control (strip HTML if you need full-text matching). Example (VB.NET):

' Assume "dt" is the DataTable with the RSS items
Public Shared Sub SearchPlayersFromTable(dt As DataTable)
    MainForm.articleListBox.Items.Clear()
    Dim players = addTeamForm.playerListBox.Items.Cast(Of Object)() _
                  .Select(Function(o) o.ToString()).ToArray()
    Dim seen As New HashSet(Of String)(StringComparer.OrdinalIgnoreCase)
    For Each r As DataRow In dt.Rows
        Dim desc = If(r.IsNull("description"), String.Empty, r("description").ToString())
        desc = System.Text.RegularExpressions.Regex.Replace(desc, "<.*?>", "") 'optional: remove tags
        For Each p In players
            If Not String.IsNullOrWhiteSpace(p) AndAlso desc.IndexOf(p, StringComparison.OrdinalIgnoreCase) >= 0 Then
                Dim title = If(dt.Columns.Contains("title") AndAlso Not r.IsNull("title"), r("title").ToString(), desc)
                If seen.Add(title) Then MainForm.articleListBox.Items.Add(title)
                Exit For
            End If
        Next
    Next
End Sub

If you want to use a DataView / RowFilter instead, build safe LIKE expressions (escape single quotes and any wildcard characters). DataView.RowFilter uses the DataColumn.Expression syntax; both "*" and "%" work as wildcards and special chars must be escaped. Example filter: description LIKE '%Jimmy Graham%' (use an escape helper around user names). See the DataColumn.Expression and DataView.RowFilter docs for the exact escaping rules. (learn.microsoft.com)

Troubleshooting tips: verify the table/column names (DataSet.Tables.Contains("item")), handle DBNulls, avoid duplicate adds (use a HashSet), and cache feeds if you hit many URLs. Screen-scraping is a fallback; for RSS content the syndication API or plain XML parsing is simpler and more reliable. For DataTable.Select alternatives see docs. (learn.microsoft.com)

Hi,
You should be able to pick up some freeware Screen scraping software to do this for you...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.