Please help in escaping this SQL string to C# string
<pre><code>'&lt;ad name="'+ am.name+ '" tag="C" cityid="'+cast(am.city_id as varchar) +'" 
 stateid="'+convert(varchar(11),cast(cm.state_id as varchar)) +'" capital="N"&gt; 
 &lt;/ad&gt;' as chkdata 
</code></pre>

<p>I have above  statement in SQL query.</p>

<p>I want to add this to C# string</p>

<p>Unsucessful attempt</p>

<pre><code>string sqlqry = "\'&lt;ad name=""\'+ am.name_id + \'"" tag=""C"" 
cityid=""\'+cast(am.city_id as varchar) +\'"" 
stateid=""\'+convert(varchar(11),cast(cm.state_id as varchar)) +\'"" capital=""N""&gt;
&lt;/ad&gt;\' as chkdata ,";
</code></pre>

<p>Later I am doing this . I am building a query in string.</p>

<pre><code>sqlcountcmd = new SqlCommand(finalsqlqry, sqlconn);
</code></pre>

<p>+1 to all guaranteed</p>
