ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create Excel Worksheet in C# / VB (https://www.excelbanter.com/excel-programming/286766-create-excel-worksheet-c-vbulletin.html)

Horst Walter

Create Excel Worksheet in C# / VB
 
I create an Excel worksheet in C# (should be similar in VB)

Connection String:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";

Create string:
"CREATE TABLE S1 (Dt date, St char(40), Cr currency)"

Works fine, but the worksheet is named _S1 (UNDERSCORE!) and not S1.
Why does this happen? Any ideas?

Thx HW

Miha Markic

Create Excel Worksheet in C# / VB
 
Hi Horst,

Wild guessing he maybe iit s some sort of reserved word (i think it is
afraid of cell naming...).
Try with other names - they should work

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rhand.com

"Horst Walter" wrote in message
m...
I create an Excel worksheet in C# (should be similar in VB)

Connection String:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";

Create string:
"CREATE TABLE S1 (Dt date, St char(40), Cr currency)"

Works fine, but the worksheet is named _S1 (UNDERSCORE!) and not S1.
Why does this happen? Any ideas?

Thx HW




Val Mazur

Create Excel Worksheet in C# / VB
 
Hi,

Try to wrap table name into square brackets

CREATE TABLE [S1] ...

--
Val Mazur
Microsoft MVP
Check Virus Alert, stay updated
http://www.microsoft.com/security/incident/blast.asp

"Horst Walter" wrote in message
m...
I create an Excel worksheet in C# (should be similar in VB)

Connection String:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";

Create string:
"CREATE TABLE S1 (Dt date, St char(40), Cr currency)"

Works fine, but the worksheet is named _S1 (UNDERSCORE!) and not S1.
Why does this happen? Any ideas?

Thx HW




Miha Markic

Create Excel Worksheet in C# / VB
 
Hi Val,

"Val Mazur" wrote in message
...
Hi,

Try to wrap table name into square brackets

CREATE TABLE [S1] ...


It doesn't work (already tried that :) ). Also parenthesis have no effect...

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
www.rthand.com



Horst Walter

Create Excel Worksheet in C# / VB
 
Thanks for your answers.
As a matter of fact, the name S1 seems to be the problem.

Summary:
========
This works:
CREATE TABLE mytable (Dt date, St char(40), Cr currency)

CREATE TABLE S1 (Dt date, St char(40), Cr currency)
= Worksheet's name will be _S1

CREATE TABLE [S1] (Dt date, St char(40), Cr currency)
does not work



Google index
C# Excel worksheet underscore

(Horst Walter) wrote in message om...
I create an Excel worksheet in C# (should be similar in VB)

Connection String:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";

Create string:
"CREATE TABLE S1 (Dt date, St char(40), Cr currency)"

Works fine, but the worksheet is named _S1 (UNDERSCORE!) and not S1.
Why does this happen? Any ideas?

Thx HW


Rob Panosh

Create Excel Worksheet in C# / VB
 
Horst,

Don't mean to jump on on your thread here but I have a question for you. Do
you know where I can find documentation for Excel when creating tables using
ADO.Net? i.e. - datatypes and general syntax ...

Thanks,
Rob Panosh

"Horst Walter" wrote in message
m...
I create an Excel worksheet in C# (should be similar in VB)

Connection String:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";

Create string:
"CREATE TABLE S1 (Dt date, St char(40), Cr currency)"

Works fine, but the worksheet is named _S1 (UNDERSCORE!) and not S1.
Why does this happen? Any ideas?

Thx HW




Paul Clement

Create Excel Worksheet in C# / VB
 
On Mon, 5 Jan 2004 07:10:17 -0600, "Rob Panosh"
wrote:

¤ Horst,
¤
¤ Don't mean to jump on on your thread here but I have a question for you. Do
¤ you know where I can find documentation for Excel when creating tables using
¤ ADO.Net? i.e. - datatypes and general syntax ...
¤

You should be able to use the Jet database provider DDL syntax:

HOWTO: Common DDL SQL for the Microsoft Access Database Engine
http://support.microsoft.com/default...;EN-US;Q180841


Paul ~~~
Microsoft MVP (Visual Basic)

scorpion53061

Create Excel Worksheet in C# / VB
 
Try this:

http://www.kjmsolutions.com/datasetarray.htm

This will write the dataset to an array and then to an excel spreadsheet.

Also, solutions like these can be found by using the VB.NET/ADO.NET free
search engine tool at
http://www.kjmsolutions.com/newsgrouptool.htm


"Rob Panosh" wrote in
message ...
Horst,

Don't mean to jump on on your thread here but I have a question for you.

Do
you know where I can find documentation for Excel when creating tables

using
ADO.Net? i.e. - datatypes and general syntax ...

Thanks,
Rob Panosh

"Horst Walter" wrote in message
m...
I create an Excel worksheet in C# (should be similar in VB)

Connection String:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filename + ";" +
"Extended Properties=Excel 8.0;";

Create string:
"CREATE TABLE S1 (Dt date, St char(40), Cr currency)"

Works fine, but the worksheet is named _S1 (UNDERSCORE!) and not S1.
Why does this happen? Any ideas?

Thx HW






Rob Panosh

Create Excel Worksheet in C# / VB
 
Thanks...

Rob

"Paul Clement" wrote in message
...
On Mon, 5 Jan 2004 07:10:17 -0600, "Rob Panosh"


wrote:

¤ Horst,
¤
¤ Don't mean to jump on on your thread here but I have a question for you.

Do
¤ you know where I can find documentation for Excel when creating tables

using
¤ ADO.Net? i.e. - datatypes and general syntax ...
¤

You should be able to use the Jet database provider DDL syntax:

HOWTO: Common DDL SQL for the Microsoft Access Database Engine
http://support.microsoft.com/default...;EN-US;Q180841


Paul ~~~
Microsoft MVP (Visual Basic)





All times are GMT +1. The time now is 03:57 AM.

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