Click here to Skip to main content
15,892,059 members
Articles / Web Development / ASP.NET

Very Powerful, Generic, Irony Based, Database Searcher

Rate me:
Please Sign up or sign in to vote.
4.00/5 (6 votes)
26 Aug 2010Ms-PL8 min read 30.4K   546   29  
Usage of Irony to produce a Google-like search tool on any column in a database
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace searchComponent.search
{
    /// <summary>
    /// This class contains a result from a search.
    /// </summary>
    public class SearchResult
    {
        #region Fields
        /// <summary>
        /// Data containing all the resulting rows. This will be empty when there are no rows
        /// and no columns will be defined.
        /// </summary>
        private DataSet _data;
        /// <summary>
        /// This message contains possible errors in the query, messages with suggestions, the 
        /// number of results found, etc.
        /// </summary>
        private string _message;
        /// <summary>
        /// This field will contain the generated query that the searcher will use to generate
        /// the dataset
        /// </summary>
        private string _generatedQuery;
        #endregion

        #region Attributes
        /// <summary>
        /// Data containing all the resulting rows. This will be empty when there are no rows
        /// and no columns will be defined.
        /// </summary>
        public DataSet Data
        {
            get { return _data; }
        }
        /// <summary>
        /// This message contains possible errors in the query, messages with suggestions, the 
        /// number of results found, etc.
        /// </summary>
        public string Message
        {
            get { return _message; }
        }
        /// <summary>
        /// This field will contain the generated query that the searcher will use to generate
        /// the dataset
        /// </summary>
        public string GeneratedQuery
        {
            get { return _generatedQuery; }
        }
        #endregion

        #region Constructor
        /// <summary>
        /// Simple constructor, all is needed is the vaules for the fields.
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="d"></param>
        public SearchResult(string msg, DataSet d, string query)
        {
            this._data = d;
            this._message = msg;
            this._generatedQuery = query;
        }

        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Chief Technology Officer Artexacta
Bolivia Bolivia
just a coder. Love Java, but working on asp.net

Comments and Discussions