C# .NET oledb Excel Reading , Column name truncated

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhitam30111985
    New Member
    • Aug 2007
    • 112

    C# .NET oledb Excel Reading , Column name truncated

    Hi all,


    I am using oledb to read values from an excel file as follows :

    Code:
    
      Dataset DS = new Dataset();
      OleDbCommand objCmdSelect = new OleDbCommand("SELECT * FROM [Sheet1$] where UrlID=" + Somevalue , objConn);
                    OleDbDataAdapter objAdapter1 = new OleDbDataAdapter();
                    objAdapter1.SelectCommand = objCmdSelect;
                    DataSet DS = new DataSet();
                    objAdapter1.Fill(DS);
    
    string SomeCol = DS.Tables[0].Columns[9].ColumnName.ToString();
    Here the actual columnname is :
    "Problems with Access Control of Business Information in Modern Enterprises"

    But in the SomeCol variable , it is coming as :
    "Problems with Access Control of Business Information in Modern E"

    Also, sometimes , the coumnname is simply appended by a "#" like :

    "Problems with Access Control of Business Information in Modern Enterprises#"

    I cant figure out what is worng.

    Any help appreciated.

    Regards,
    Rhitam.
Working...