private string StripSpecialChars(string inputString)
{
return (Regex.Replace(StripHTML(inputString), "[^A-Za-z0-9 ,]", ""));
}
Monday, November 29, 2010
How to strip non-alphanumeric chars from a string
The example below also leaves the space character and commas intact.
How to strip HTML tags out of a string
static string StripHTML(string inputString)
{
return Regex.Replace
(inputString, "<.*?>", string.Empty);
}
Saturday, November 13, 2010
How to reseed an identity field
When I create e-commerce sites, the order numbers always start at 1. My customers like to pretend that they've had lots of orders when they launch, so I need to update their order number to something higher. The problem is this is always the identity field of the table. This command does the trick. It doesn't update the old order numbers, but I don't need those updated so it's no big deal.
DBCC CHECKIDENT('order', RESEED, 1000070 )
DBCC CHECKIDENT('order', RESEED, 1000070 )
Subscribe to:
Posts (Atom)