excel - How to avoid OLEDB converting "."s into "#"s in column names? -
i'm using ace oledb driver read excel 2007 spreadsheet, , i'm finding '.' character in column names converted '#' character. example, if have following in spreadsheet:
name amt. due due date andrew 12.50 4/1/2010 brian 20.00 4/12/2010 charlie 1000.00 6/30/2010
the name of second column reported "amt# due" when read following code:
oledbconnection connection = new oledbconnection( "provider=microsoft.ace.oledb.12.0; data source=myfile.xlsx; " + "extended properties=\"excel 12.0 xml;hdr=yes;fmt=delimited;imex=1\""); olddbcommand command = new oledbcommand("select * mytable", connection); oledbreader datareader = command.executereader(); system.console.writeline(datareader.getname(1));
i've read through documentation can find , haven't found mentions happen. has run before? there way fix behavior?
see oledbadapter excel qa posted via stack overflow.
i made .xlsx workbook in excel data, , changed oledbconnection , read in data fine.
string sql = "select f1, f2, f3 [sheet1$] f1 not null"; oledbconnection connection = new oledbconnection("provider=microsoft.ace.oledb.12.0;data source=" + prmpathexcelfile + @";extended properties=""excel 12.0;imex=1;hdr=no;typeguessrows=0;importmixedtypes=text""");
writing data console:
name amt. due due date andrew 12.50 4/1/2010 brian 20.00 4/12/2010
Comments
Post a Comment