LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default HRESULT: 0x800A03EC setting DataSource for pivot tables.

Hi all --

I am trying to query one excel spreadsheet and set this query as the
data source for a pivot table in another spreadsheet using C#. The
code goes like this -- (note, the names have been changed to protect
the innocent :):

msQuery = new String[5]

msQuery[0] = @"DSN=Excel Files;DBQ=<datasource excel
file path;DriverId=790;MaxBufferSize=2048;PageTimeout= 30";
msQuery[1] = string.Format("SELECT `'{0}'`.`Column A`,
`'{0}'`.`Column B`, ", sheetName + "$");
msQuery[2] = string.Format("`'{0}'`.`Column C`,
`'{0}'`.`Column D`, ", sheetName + "$");
msQuery[3] = string.Format("FROM `'{0}'`", sheetName +
"$");
msQuery[4] = string.Format("WHERE (`'{0}'`.`Column A`
Is Not Null)", sheetName + "$");

Excel.PivotTable pt = (Excel.PivotTable)xlSheet.PivotTables(<worksheet
name);


pt.SourceData = msQuery;
pt.RefreshTable();

On the line "pt.SourceData = msQuery;" I get the dreaded HRESULT:
0x800A03EC exception. I have tried changing the permissions for the
asp.net user account and culture info shouldn't be an issue (everything
is en-US).

Entire exception text is:
System.Runtime.InteropServices.COMException was caught
Message="Exception from HRESULT: 0x800A03EC"
Source=""
ErrorCode=-2146827284
StackTrace:
at System.RuntimeType.ForwardCallToInvokeMember(Strin g
memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes,
MessageData& msgData)
at Excel.PivotTable.set_SourceData(Object )
at Generator.ModifyPivotTables(Workbook xlTemplateWorkBook,
String localDataFile) in C:\Generator.cs:line 1534
at ExcelGenerator.Gen

Has anyone dealt with this issue with any success?

Thanks in advance for your help!

Katherine

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datasource for pivot tables Bill Excel Discussion (Misc queries) 3 August 3rd 06 10:15 PM
Exception from HRESULT: 0x800A03EC nano2k New Users to Excel 0 July 21st 06 12:15 PM
Pivot Tables -changing datasource for exsting Pivot Table kfschaefer Setting up and Configuration of Excel 0 May 30th 06 06:36 PM
Excel returns hresult 0x800A03EC at inserting Hyperlinks (C#) Matthias Kwiedor Excel Programming 0 October 20th 05 10:24 AM
Chart.Export throws COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC. Steven Excel Programming 1 November 5th 03 06:59 PM


All times are GMT +1. The time now is 10:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"