Using CREATE TABLE DDL on Excel creates two tables

M

Minherz

Hello. I am using OLEDB 4.0 to create an excel file and store DataTable rows
into it. I am using

CREATE TABLE [SheetName] ([Column1] longtext, [Column2] longtext....

DDL and then write data using INSERT INTO ... DDL.

There are three strange things that i've encountered and will be glad to get
help from anyone:

1. If I use as a table name expression with spaces, the name is changed
to expression with underscore '_' symbol instead of spaces.
2. I can not set trailing '$' when creating a table, but when inserting
data I have to use the name with traling '$' otherwise the exception is
thrown. Moreover, if i get the scheme of the Excel file later I am getting
TWO tables instead of one: a first with the name without '$' and another the
same with trailing '$'. Nedless to say that visually Excel shows only a name
without '$'
3. If I am trying to do same operations using OLEDB 12.0 (Office2007) I
get invalid file.


If anyone knows how I can overcome above issues, please write me a code. I
am coding in C# but VB examples are as good as any other.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top