TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kobus_2000
NA
14
0
Inserting data into Excel sheet using sql
Jul 18 2005 5:59 AM
Hi
I am using the
Microsoft.Jet.OLEDB to connect to an Excel workbook
I can use the following sql to insert data into the Excel sheet (I hope my syntax is correct. I do not have the compiler with me):
String sql = "Insert INTO [Sheet1$] (Lastname, Firstname1) Values ('XXX', 'YYY')";
OleDbCommand cmdExcel = new OleDbCommand(sql, conn);
OleDbDataReader drExcel = cmdExcel.ExecuteReader();
The problem that I have, is that for that INSERT to work those column headers (eg
Lastname, Firstname1)
need to exist in the workbook. I want to create a new workbook using code and insert data without having column names to insert the data under. How would I change the INSERT sql to specify in which column to insert data in (eg in A, B, etc).?
Thanks.
Kobus
Reply
Answers (
1
)
Stopping Excel process inside C#?
Private Dll