Cannot open DBF with spaces in the path
<p>using the following works when there is no spaces in the directory names</p>

<p>for string file1 it will execute reader with string file2 it will create an exception? I need to access folders that will have spaces in their path for some of our clients.</p>

<pre><code>file1 = "C:\\test1\\file.dbf";
file2 = "C:\\test 2\\file.dbf";

OdbcConnection Connection = new OdbcConnection();
Connection.ConnectionString = @"Driver={Microsoft Visual FoxPro Driver};Exclusive=No;SourceType=DBF;SourceDB=" + strFilename + ";";
Connection.Open();

OdbcCommand Command = Connection.CreateCommand();
Command.CommandText = @"SELECT * FROM " + file1; //Command.CommandText = @"SELECT * FROM " + file2;
</code></pre>

<p>once executing 
    Connection.Open();
 it opens it correctly, </p>

<p>once we execute 
     OdbcDataReader Reader = Command.ExecuteReader(); </p>

<p>I get <em>{System.Data.Odbc.OdbcException: ERROR [42S02] [Microsoft][ODBC Visual FoxPro Driver]File 'file2.dbf' does not exist.</em></p>

<hr>

<p>Answer since I don't have enough rep</p>

<p>Thanks for everyones contribution the solution to my problem. The solution required that I put the full path (that has a space in it) and make it literal string using the @ char. For some reason making it literal by putting quotations with escape characters ("\"") did not solve it.</p>

<p>In summary, I used @ in front of the path in the connection string and in the command string.</p>

<pre><code>strFilename = S.ImportFolder + "\\" +"file"+ ".dbf";

OdbcConnection Connection = new OdbcConnection();
Connection.ConnectionString = @"Driver={Microsoft Visual FoxPro Driver};Exclusive=No;SourceType=DBF;SourceDB="+@strFilename+";";
Connection.Open();

OdbcCommand Command = Connection.CreateCommand();
Command.CommandText = @"SELECT * FROM "+ @strFilename;

OdbcDataReader Reader = Command.ExecuteReader();
</code></pre>
