Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing CSV file in Windows Server 2008 64 C#
    primarykey
    data
    text
    <p>I'm having some trouble parsing a *.CSV file in windows server 2008 64bit version. The problem it that Jet OLEDB 4.0 doesn't read the header row, presented in the CSV.</p> <p>That means, that when I try to access one of the columns like this:</p> <pre><code>DataTable tbl = GetCsvData(); string sd = tbl.Rows[0]["id"].ToString(); </code></pre> <p>The program throws an exception, saying that the column does not belong in the datable.</p> <p>I'm using the following code:</p> <pre><code>public DataTable GetCsvData() { FileInfo file = new FileInfo(this.fileName); string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + file.DirectoryName + "\\;" + "Extended Properties=\"text;HDR=Yes;FMT=Delimited(;)\";"; OleDbConnection objConn = new OleDbConnection(connectionString); objConn.Open(); OleDbCommand objCmdSelect = new OleDbCommand(string.Format("SELECT * FROM [{0}]", file.Name), objConn); OleDbDataAdapter adp = new OleDbDataAdapter(objCmdSelect); DataTable tbl = new DataTable("CSVData"); adp.Fill(tbl); objConn.Close(); objConn.Dispose(); return tbl; } </code></pre> <p>As you can see, the Extended Properties are correct: "HDR=Yes", this forces the Jet engine to read the header row on the CSV file.</p> <p>The problem is really strange because I can read the same CSV file on my development machine ( Windows XP SP3 ), with absolutely no problem.</p> <p>I think this is a problem derived to the 64 bit version of Windows server 2008.</p> <p>I checked the versions of the msjet40.dll file on both the server and local machine:</p> <pre><code>Windows XP SP3 =&gt; 4.0.9551 Windows Server 2008 64 bit =&gt; 4.0.9755 </code></pre> <p>The problem isn't on the CSV file, it's in the driver provided by Microsoft ( at least is what I think ), since I can read the CSV file perfectly on my machine.</p> <p>Does one has any idea a way to solve this problem? I googled a lot, but I couldn't find anything.</p> <p>Thanks..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload