How to execute foxpro 2.6(DOS) commands from C# that needs exclusive access to table?
<p>This is my code, and I want to delete all the data of the FoxPro tables named as SMS_DATA, I tried <strong>ZAP</strong> command, as well as also tried <strong>DELETE ALL</strong> and <strong>PACK</strong> command with the <strong>USE</strong> -table-name, but it doesn't working, and gives the exception that:</p>

<pre class="lang-none prettyprint-override"><code>System.Data.OleDb.OleDbException (0x80004005): File must be opened exclusively.
</code></pre>

<p>This is my code:   </p>

<pre><code>     string USETBL ="EXECSCRIPT([USE SMS_DATA &amp;&amp; Open SMS_DATA table])";
     string DELETE="EXECSCRIPT([DELETE ALL])";       
     string PACK="EXECSCRIPT([PACK])";

                       OleDbConnection con = new OleDbConnection(conStr);
                       try
                       {

                           OleDbCommand cmd  = new OleDbCommand(USETBL, con);
                           OleDbCommand cmd1 = new OleDbCommand(DELETE, con);
                           OleDbCommand cmd2 = new OleDbCommand(PACK, con);

                           con.Open();
                           err.log("connection opened");
                           cmd.ExecuteNonQuery();
                           err.log("table in use");
                           cmd1.ExecuteNonQuery();
                           err.log("delete executed.");
                           cmd2.ExecuteNonQuery();
                           err.log("pack executed.");
                           con.Close();
                       }
                       catch (Exception e)
                       {
                           err.log("Exception:-" + e);
                       }
</code></pre>