Skip to content

Commit 398098d

Browse files
committed
added checkHiddenExcelInstance to warn user about background excel (at startup and via checkpurgeNames)
added lookups refresh after DBSheet modifications, added additional encryption information to OLEDB connection string in DBListFetch if required by Encrypt=true in normal connection string added info about problems with encrypt=yes and packet size >16387
1 parent fea3323 commit 398098d

14 files changed

+171
-116
lines changed

docs/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ This can be done by modifying DBAddin.xll.config or the referred DBAddinUser.con
5454

5555
Explanation:
5656
* `ConfigName`**N**: freely definable name for your environment (e.g. Production or your database instance)
57-
* `ConstConnString`**N**: the standard connection string used to connect to the database. Set `ODBC;` in front to specify ODBC connection strings explicitly.
57+
* `ConstConnString`**N**: the standard connection string used to connect to the database. Set `ODBC;` in front to specify ODBC connection strings explicitly. Pay attention to the Packet Size parameter when Encrypt=yes (for ADO connections)!
5858
* `ConfigStoreFolder`**N**: all config files (*.xcl) under this folder are shown in a hierarchical manner in "load config"
5959
* `ConnStringSearch`**N**: part to be searched for replacement within the standard connection string in DBModifiers and DBRowFetch.
6060
* `ConnStringReplace`**N**: replacement for above
@@ -233,6 +233,10 @@ Following topics are still to be done:
233233

234234
* Utilizing optimistic concurrency for DBSheets (similar to the old Addin, but with ADO.NET support)
235235

236+
### Known Issues
237+
238+
* With Encryption (Encrypt=yes) there is a limit for the Packet Size parameter in the connection string, currently this seems to be 16387. Any value above leads to transport layer errors in ADO.NET: Error executing sqlCommand: Error when receiving Results from the Server. (provider: TCP Provider, error: 0 - The Network name is missing.)
239+
236240
### History (from the very beginning)
237241

238242
* 2006: First versions of DBFuncs and DBSheets implemented as xla Addins.

source/AddInEvents.vb

+20-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ Imports System.Diagnostics
88
Imports System.Runtime.InteropServices
99
Imports System.Collections.Generic
1010

11+
Public Module CheckInstance
12+
Public Sub checkHiddenExcelInstance()
13+
Try
14+
' check for multiple excel instances
15+
If Process.GetProcessesByName("Excel").Length > 1 Then
16+
For Each procinstance As Process In Process.GetProcessesByName("Excel")
17+
If procinstance.MainWindowTitle = "" Then
18+
UserMsg("Another hidden excel instance detected (PID: " + procinstance.Id + "), this may cause problems with querying DB Data")
19+
End If
20+
Next
21+
End If
22+
Catch ex As Exception : End Try
23+
End Sub
24+
End Module
1125

1226
''' <summary>AddIn Connection class, also handling Events from Excel (Open, Close, Activate)</summary>
1327
<ComVisible(True)>
@@ -78,6 +92,7 @@ Public Class AddInEvents
7892
' after getting the default environment (should exist), set the Const Connection String again to avoid problems in generating DB ListObjects
7993
ConstConnString = fetchSetting("ConstConnString" + env(), "")
8094
ConfigStoreFolder = fetchSetting("ConfigStoreFolder" + env(), "")
95+
checkHiddenExcelInstance()
8196
End Sub
8297

8398
''' <summary>AutoClose cleans up after finishing addin</summary>
@@ -283,7 +298,7 @@ done:
283298
DBModifDefColl = New Dictionary(Of String, Dictionary(Of String, DBModif))
284299
End If
285300
LogInfo("getting DBModif Definitions on Workbook Activate")
286-
DBModifs.getDBModifDefinitions()
301+
getDBModifDefinitions()
287302
' unfortunately, Excel doesn't fire SheetActivate when opening workbooks, so do that here...
288303
LogInfo("assign command button click handlers on Workbook Activate")
289304
assignHandler(Wb.ActiveSheet)
@@ -348,7 +363,7 @@ done:
348363
Dim DBModifName As String = getDBModifNameFromRange(targetRange)
349364
End If
350365
If My.Computer.Keyboard.CtrlKeyDown And My.Computer.Keyboard.ShiftKeyDown Then
351-
DBModifs.createDBModif(DBModifType, targetDefName:=cbName)
366+
createDBModif(DBModifType, targetDefName:=cbName)
352367
Else
353368
DBModifDefColl(DBModifType).Item(cbName).doDBModif()
354369
End If
@@ -434,7 +449,7 @@ done:
434449
Private Sub Application_SheetChange(Sh As Object, Target As Range) Handles Application.SheetChange
435450
' avoid entering into insert/update check resp. doCUDMarks if not list-object (data table), whole column modified, no DBMapper present and prevention while fetching (on refresh) being set
436451
If Not IsNothing(Target.ListObject) AndAlso Not Target.Rows.Count = Sh.Rows.Count AndAlso DBModifDefColl.ContainsKey("DBMapper") AndAlso Not DBModifs.preventChangeWhileFetching Then
437-
Dim targetName As String = DBModifs.getDBModifNameFromRange(Target)
452+
Dim targetName As String = getDBModifNameFromRange(Target)
438453
If Left(targetName, 8) = "DBMapper" Then
439454
DirectCast(DBModifDefColl("DBMapper").Item(targetName), DBMapper).insertCUDMarks(Target)
440455
End If
@@ -541,14 +556,14 @@ done:
541556
''' <param name="Ctrl"></param>
542557
''' <param name="CancelDefault"></param>
543558
Private Sub mDeleteButton_Click(Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) Handles mDeleteButton.Click
544-
DBModifs.deleteRow()
559+
deleteRow()
545560
End Sub
546561

547562
''' <summary>dynamic context menu item insert: insert row in CUD Style DBMappers</summary>
548563
''' <param name="Ctrl"></param>
549564
''' <param name="CancelDefault"></param>
550565
Private Sub mInsertButton_Click(Ctrl As Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean) Handles mInsertButton.Click
551-
DBModifs.insertRow()
566+
insertRow()
552567
End Sub
553568

554569
Protected Overrides Sub Finalize()

0 commit comments

Comments
 (0)