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: 2
Default Excel PivotTable C# problem

Hello to all,
can anybody help me with this problem:

I'm connecting an Excel PivotTable to a MySQL database. The PivotTable
is created, but when I open one of the item-list dialogs by pressing
the small button in the PivotField headers, select some items (even if
I leave them as they are) and confirm with OK, then Excel crashes. I
have no idea why. The only thing I noticed is that the connection
string could be a problem.

I tried to connect also by specifying the Connection and the
CommandText property of the PivotCache. The problem ocurred then, when
I put all in a loop and create more than one PivotTable (each in a new
Worksheet).

It would be great if anybody could tell me what is going on.
Thanks a lot,
Markus

PD:
The code I'm using is:

strConnection = "DSN=MyDSN;OPTION=3;UID=MyUID;PASSWORD=;"
+ "DRIVER={MySQL ODBC 3.51 Driver};DATABASE=MyDB;"
+ "SERVER=localhost;";

strSelectCommand = "SELECT ld.Name, ld.Date FROM MyDB ld WHERE"
+ " ld.Name='A Name' AND ld.Date={d'2004-06-01'} AND "
+ "ld.Date<={d'2004-07-01'}"; // I tried it also without
the
// {d }
adoConnection = new ADODB.ConnectionClass();
adoConnection.ConnectionString = strConnection;
adoConnection.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
adoConnection.Open(null, null, null, 0);
adoRecordset = new ADODB.RecordsetClass();
adoRecordset.Open(strSelectCommand,adoConnection,
ADODB.CursorTypeEnum.adOpenStatic,
ADODB.LockTypeEnum.adLockOptimistic,0);

pcPivotCache = xlApp.ActiveWorkbook.PivotCaches().Add(Excel.
XlPivotTableSourceType.xlExternal,
Type.Missing);
pcPivotCache.Recordset = adoRecordset;
rngRange = activeSheet.get_Range("A5", Type.Missing);
pcPivotCache.CreatePivotTable(rngRange, "MyPivotTable", Type.Missing,
Type.Missing);
 
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
Pivottable getpivotdata problem Mikmac Excel Worksheet Functions 2 October 30th 09 01:17 PM
problem with pivotTable in Excel [email protected] Excel Discussion (Misc queries) 1 June 4th 08 02:36 PM
problem exporting data from Office PivotTable Components to Excel Hammami Excel Discussion (Misc queries) 0 December 22nd 06 11:16 AM
Pivottable Problem mmwheeler Charts and Charting in Excel 1 August 4th 05 04:08 AM
Excel 2002 -> Problem with calculated fields in Pivottable H. Riewert Excel Discussion (Misc queries) 0 December 7th 04 09:33 AM


All times are GMT +1. The time now is 07:20 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"