Oldedb Excel create table command is converting hyphens into underscores
Posted on 2010-08-25
I'm creating an excel file with vb.net and ole db. The table (worksheet) name has hyphens in it. The hyphens (-) are being converted to underscores (_) when I execute the create table command.
Here is the code:
mcliOLEDBCn = New System.Data.OleDb.OleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & astrPathAndFile & ";Mode=ReadWrite;Extended Properties=""Excel 8.0;HDR=YES"")
mcliOLEDBCom = New OleDbCommand("CREATE TABLE [AR-08-25-2010] ([ITEMNO] MEMO , [QUANTITY] int)", mcliOLEDBCn)
The worksheet inside the excel file ends up named as AR_08_25_2010 instead of AR-08-25-2010.
I am using visual studio 2008, vb, and windows 7. I tried it with the ace provider for excel 2007 and got the same result.
How do I insert hyphens into the table name?
Any help would be appreciated. Thanks!