boycoto

boycoto

  • NA
  • 147
  • 125.5k

Lack of one record in reading data file using OleDB.

Aug 4 2012 9:14 AM
Hi guys, I am a bit curious why does the dataset contains only 9 rows wherein there were 10 records in a data file.
I used the following codes to retrieve data from a file...
[QUOTE]
            OleDbDataAdapter oleData;
            DataSet dsData = new DataSet();
            string strOleConnection = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + Path.GetDirectoryName(strFile) +
                                      ";Extended Properties='text;HDR=Yes;FMT=Delimited(,)'";
            string strRetrieveData = "SELECT * FROM " + Path.GetFileName(strFile);
            oleCSVData = new OleDbDataAdapter(strRetrieveData, strOleConnection);
            oleCSVData.Fill(dsData);
[/QUOTE] 

However, if I am going to retrieve data from the file using StreamReader, I can able to retrieve all records.
Another thing, which is faster in retrieving records on a data file, is it using StreamReader or OleDB.
I need your help and guidance.

Answers (2)