Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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); |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Pivottable getpivotdata problem | Excel Worksheet Functions | |||
problem with pivotTable in Excel | Excel Discussion (Misc queries) | |||
problem exporting data from Office PivotTable Components to Excel | Excel Discussion (Misc queries) | |||
Pivottable Problem | Charts and Charting in Excel | |||
Excel 2002 -> Problem with calculated fields in Pivottable | Excel Discussion (Misc queries) |