Pronunciation / adjective
Bringing something good and unforseen.
    Skip Navigation Links > Component Library > Search Object

The Fortunate.Search object contains advanced algorithims to easily search any DataTable in your windows development and web development.



Download the Fortunate Library Here:

Fortunate Library 32bit - Stand-Alone Install

Fortunate Library 64bit - Stand-Alone Install

Fortunate Library Solution - Source Code

The Fortuante.Search object accepts any DataTable, a list columns which should be searched, and a search word(s). It then returns a DataView with each row of the original DataTable returned in the order of best match to the search word(s) to least match.

Here is the code I use to search the Code Repository entries:
  1. '---Create the stored procedure
  2. Dim SQLCommand As New Data.SqlClient.SqlCommand()
  3. SQLCommand.CommandType = Data.CommandType.StoredProcedure
  4. SQLCommand.CommandText = "procCodeLibraryGetAllEntries"
  5. '---Get all results from the code library to search through
  6. Dim CodeLibraryDataTable As DataTable = Master.DataObject.GetDataTable(SQLCommand, "CodeLibraryEntriesTable")
  7. '---Create an array of column names to search
  8. Dim SearchColumnNames As String() = {"CategoryName", "LanguageName", "CodeTitle", "CodeDescription"}
  9. '---Create the search object
  10. Dim FortunateSearchObject As New Fortunate.Search
  11. '---"CodeTitle" in the GetSearchResults method weights a row higher if a search word is found in the column name entered
  12. CodeGridView.DataSource = FortunateSearchObject.GetSearchResults(CodeLibraryDataTable, SearchColumnNames, Master.DataObject.EscapeString(SearchTextBox.Text.Trim()), "CodeTitle")
  13. CodeGridView.DataBind()
Microsoft Certified Professional   © 2018 Fortunate.  All rights reserved.