XLL Functions work for a moment, then stops working

Add-in Express™ Support Service
That's what is more important than anything else

XLL Functions work for a moment, then stops working
 
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hi Rafael,

Please send me the code to the support e-mail address, see {Add-in Express}\readme.txt. Please make sure your e-mail contains a link to this topic.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 01 Nov, 2010 05:45:29 Top
Rafael Castañeda




Posts: 36
Joined: 2010-04-05
I have sent code, database and excel file so you can review it

thanks in advance

Rafael
Posted 11 Nov, 2010 17:54:46 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hi Rafael,

On the Compile tab of the project Properties window, I've set Option Strict to On and got two compile errors:

- at Return "No hay datos"
- at Return ex.Message

These are two "instances" of the same error: if the return value of the UDF is of a certain type, you must not return a value of some other type. To bypass this, try to change the function definitions so that the function return Object, not double, say:

Public Shared Function A_Cargos(...) As Object

In addition, consider returning an Excel-recognized error value, say AddinExpress.MSO.ADXxlCVError.xlErrNA or AddinExpress.MSO.ADXxlCVError.xlErrValue.

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 12 Nov, 2010 02:36:03 Top
Rafael Castañeda




Posts: 36
Joined: 2010-04-05
Hi all, I have solved the problem of my UDF´s , followed your advice and converted all UDF to return an Object and turned on Option Strict, but the problem persisted, any way those where good advices that I incorporated into my code.

The real problem was that each time one of my functions was calculated, a database connection was created then closed, but never disposed, so after 70 or 80 recalculations I think the memory just could not take any more.

The problem was solved when I added the dipose method to my connection, command and reader objects.

Thanks for your help
Posted 16 Nov, 2010 10:13:46 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Rafael,

Such a good news! Good luck with your add-in project!
.NET, Extended MAPI, Windows Phone & RT
Posted 16 Nov, 2010 10:52:03 Top