views:

22

answers:

0

hi everyone, I am trying to read the content of an excel sheet using the following code.

string tempExcelFileUploadPath="C:\\Documents and Settings\\......\\excelsheet.xls";
        String excelConnectionString1;
        //connection string for excel sheet 
        excelConnectionString1 = @"Provider=Microsoft.Jet.OLEDB.4.0;"
 + @"Data Source=" + tempExcelFileUploadPath + ";"
 + @"Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""";
        OleDbConnection myEcelConnection1 = new OleDbConnection(excelConnectionString1);

        myEcelConnection1.Open();

        //Query to read the data from 1st page
        string sheet = "SELECT * FROM [sheet1$]";

        OleDbCommand cmd1 = new OleDbCommand(sheet, myEcelConnection1);

        cmd1.CommandType = CommandType.Text;
        OleDbDataAdapter myAdapter1 = new OleDbDataAdapter(cmd1);

        DataSet myDataSet1 = new DataSet();

        //Fill the dataset with the data read from 'FAQ Import Data' page
        myAdapter1.Fill(myDataSet1);

My excel sheet contains huge data.One of the columns in excel sheet contains dot delimited strings separated by commas.Using the above code when I read the data into the dataset ,I see that some of the large dot delimited strings are getting truncated.Other columns of the excel sheet also have very large text.But in the dataset they appear as is in the excel sheet.

I do not understand why the large dot delimited strings separated by comma are getting truncated.

Could someone please help me with this?

Thanks.