ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using CREATE TABLE DDL on Excel creates two tables (https://www.excelbanter.com/excel-programming/409740-using-create-table-ddl-excel-creates-two-tables.html)

Minherz

Using CREATE TABLE DDL on Excel creates two tables
 
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.


All times are GMT +1. The time now is 09:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com