473,320 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
Nov 15 '05 #1
8 13918
Hi Horst,

Wild guessing here: 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" <un***@web.de> wrote in message
news:53*************************@posting.google.co 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

Nov 15 '05 #2
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" <un***@web.de> wrote in message
news:53*************************@posting.google.co 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

Nov 15 '05 #3
Hi Val,

"Val Mazur" <gr******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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
Nov 15 '05 #4
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

un***@web.de (Horst Walter) wrote in message news:<53*************************@posting.google.c 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

Nov 15 '05 #5
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" <un***@web.de> wrote in message
news:53*************************@posting.google.co 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

Nov 15 '05 #6
On Mon, 5 Jan 2004 07:10:17 -0600, "Rob Panosh" <ro************************@asdsoftadfdware.com>
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 ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 15 '05 #7
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" <ro************************@asdsoftadfdware.com> wrote in
message news:um**************@TK2MSFTNGP09.phx.gbl...
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" <un***@web.de> wrote in message
news:53*************************@posting.google.co 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


Nov 15 '05 #8
Thanks...

Rob

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:6e********************************@4ax.com...
On Mon, 5 Jan 2004 07:10:17 -0600, "Rob Panosh" <ro************************@asdsoftadfdware.com> 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 ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 15 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
4
by: Krishna Tulasi via .NET 247 | last post by:
Hi, I am having trouble with creation of XML programmatically using .NET. Specifically Im trying to create an element which looks like below and insert into an existing xml doc: <Worksheet...
1
by: mail2atulmehta | last post by:
Hi, I do not know if this is right place for this, but i need some help. I have a text file, whose values are seprated by a delimiter. I want to open this file in excel, ( not import it) . I have...
1
by: javzxp | last post by:
Hi I'd like to use C# to open an existing Excel workbook and save each worksheet it contains into a new Excel file. The name of each new Excel file should be the name of the worksheet copied...
7
by: KC | last post by:
Does anybody know how to add a specific number of worksheets to an Excel spreadsheet through VB.net? I'm trying to export some datatables to an excel file, but I only want as many sheets in the...
3
by: James Wong | last post by:
Dear all, I have an old VB6 application which can create and access Excel object. The basic definition statements are as follows: Dim appExcel As Object Dim wkb1 As Excel.Workbook Dim wks1...
1
by: Randall Arnold | last post by:
I'm converting a vbscript program to vb.net. Witht he exception of .net idiosyncrasies, most of it is working well with the same code. My only problem is that some properties and methods are...
9
by: John Brock | last post by:
I am trying to create a workbook where one of the worksheets contains an AutoFiltered table. It looks like it should be simple -- what I am doing is this: rng = ws.Range("MyTableRange")...
1
by: TG | last post by:
Hi! I have an application in which I have some checkboxes and depending which ones are checked those columns will show in the datagridview from sql server or no. After that I have 2 buttons:...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.