Passing A Variable To SQL
<p>I have a variable that is an IP address. It is saved as text in my Access 2010 database. I am trying to run this query with ipSrc and the query always fails. My guess is that its seeing ipSrc as ipSrc and not as the actual IP address. I tried it with 'ipSrc' and just plain ipSrc and both reurn fail. Also tried ""ipSrc"", failed as well. This failed to. '&amp;ipSrc'. Here is the statement.</p>

<pre><code>SQLCHAR* query = (SQLCHAR*)"SELECT tblIP.[IPAddress], tblIP.[IPType], tblIP.[IPStatus], tblIP.[IPMax] FROM tblIP WHERE tblIP.[IPAddress]= ipSrc AND tblIP.[IPType]=3 AND tblIP.[IPStatus]=1 AND tblIP.[IPMax]=0;"; 
</code></pre>

<p>and here is the definition of ipSrc.</p>

<pre><code>translate_ip(ip_header-&gt;source_ip, ipSrc);
</code></pre>

<p>Using printf it prints out as an actual IP address.</p>

<pre><code>printf("\n   Source      IP: %s", ipSrc);
</code></pre>
