Advertisement

07.22.2008 at 01:45PM PDT, ID: 23586545
[x]
Attachment Details

How do I fix 'cannot expand named range' exception when using OleDB and C# to insert data into an Excel spreadsheet.

Asked by Giawa in C# Programming Language, Microsoft Excel Spreadsheet Software, Data Manipulation

Tags: Microsoft, Visual Studio, Express 2008, Reading Excel file using OleDB, C#

My code is generating the following string to insert data into the Excel spreadsheet.  Can you see what is causing the exception "OleDBException" with the message "Cannot expand named range." to be thrown?

INSERT INTO [Sheet1$B2:B2](F1) VALUES(34.5)

I've also tried putting square brackets around F1 like so: INSERT INTO [Sheet1$B2:B2]([F1]) VALUES(34.5)

I am also curious why if I just pass B2: INSERT INTO [Sheet1$B2](F1) VALUES(34.5) I will get an error "Microsoft Jet Database Engine could not find the object 'Sheet1$B2'".

I am using a normal spreadsheet with two columns and many rows.  All of the cells are unlocked and filled with numbers (except the topmost cell of each column, which has a title).Start Free Trial
[+][-]07.22.2008 at 01:49PM PDT, ID: 22063534

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 01:52PM PDT, ID: 22063556

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 02:03PM PDT, ID: 22063642

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 02:14PM PDT, ID: 22063745

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 02:17PM PDT, ID: 22063782

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 02:29PM PDT, ID: 22063880

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 02:56PM PDT, ID: 22064090

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 02:59PM PDT, ID: 22064112

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 03:04PM PDT, ID: 22064140

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 03:29PM PDT, ID: 22064303

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.22.2008 at 03:56PM PDT, ID: 22064459

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C# Programming Language, Microsoft Excel Spreadsheet Software, Data Manipulation
Tags: Microsoft, Visual Studio, Express 2008, Reading Excel file using OleDB, C#
Sign Up Now!
Solution Provided By: rorya
Participating Experts: 1
Solution Grade: B
 
 
[+][-]07.22.2008 at 04:09PM PDT, ID: 22064526

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628