You will be better off using parameterized queries. They automatically process single quotes and protect you from SQL Injection.
Inserting double single quotes (did I say that?) Is a way to avoid data. It should work, but this is not the best practice.
See this article for a much more complete answer:
http://msdn.microsoft.com/en-us/library/ff648339.aspx
What I suggest is step 3.
Change - better read the question
If you are already using parameterized queries, or a stored procedure, and you set the acctName value to the parameter value, then you do not need to avoid quotes yourself, This is processed automatically.
It is also handled by several tools, including the Mirosoft Patterns and Practices database library. This has several commands where you can pass in an operator and an array of objects that are used as parameter values - which also controls the escaping.
If this is one of those cases, you can completely exclude the line of code in which you replace the values.
David source share