Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0
Hello Guys,
 
I have a problem that I couldn't find the solution.
 
The user enter some values into the textboxes and then those data is going to send to an excel file.
 
My INSERT statement is like this:
 
(Note : I use OLEDB Provider)
 
string data = "INSERT INTO [Sheet1$](A1) VALUES ('value')"
 
The error is A1 couldn't be found.
 
Awaiting answers.
 
Thanks
 
Haluk
Posted 5-Oct-12 2:30am
Edited 5-Oct-12 2:36am
v2
Comments
Wes Aday at 5-Oct-12 7:33am
   
Try [Sheet1$]

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Dont use sheet name. create header and use headers name
.
http://csharp.net-informations.com/excel/csharp-excel-oledb-insert.htm[^]
  Permalink  
Comments
haluk_78 at 5-Oct-12 7:53am
   
I know this way...
 
I can update the values according to headers name.
What if the headers are not as column?. This is because some of my values are as row so how I am gonna update values.
Dain Ucak at 5-Oct-12 8:54am
   
and this is about update
http://csharp.net-informations.com/excel/csharp-excel-oledb-update.htm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 495
1 Sergey Alexandrovich Kryukov 469
2 OriginalGriff 360
3 Sascha Lefévre 255
4 Abhinav S 250
0 Sergey Alexandrovich Kryukov 10,102
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076


Advertise | Privacy | Mobile
Web02 | 2.8.150327.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100