Archive for the month May 2009

« Older Entries   Newer Entries »

How to remove Bad Words in C#

public string RemoveBadWords(string UserComments, ArrayList BadWordsList)
{
   Regex regBad = default(Regex);
   IEnumerator ieBadWords = BadWordsList.GetEnumerator();
   while (ieBadWords.MoveNext())

   {
      regBad = new Regex(”\\b” + ieBadWords.Current.ToString());
      UserComments = regBad.Replace(UserComments, “yourtext”);
   }
   return UserComments;
}

Loading XML file in ASP.Net C#

XmlDocument doc = new XmlDocument();
        doc.LoadXml(”<sample><book id=’1′>” +
                    “<title>Pride And Prejudice</title>” +
                    “<price>19.95</price>” +
                    “</book><book id=’2′>” +
                    “<title>Hawks</title>” +
                    “<price>20.05</price>” +
                    “</book></sample>”);
       
 
        XmlNode root = doc.FirstChild;
 
     

        //Display the contents of the child nodes.
        if (root.HasChildNodes)
        {
            for (int i = 0; i < root.ChildNodes.Count; i++)
            {
                //Response.Write(root.ChildNodes[i].InnerXml);
              =2 0 Response.Write(”<br/>”);
                Response.Write(root.ChildNodes[i]["title"].InnerText);
                Response.Write(root.ChildNodes[i]["price"].InnerText);
               
            }
        }

Cannot perform ‘Like’ operation on System.Decimal and System.String.

When i was trying to use the dataview rowfilter functionality, i came across this type of issue.
I tried to find some soultions on internet but was unable to get any..
This issue comes when we try to search from the column which is numeric / decimal suing LIKE query, hence the datatype decimal doesnt matches with [...]