Welcome to MSDN Blogs Sign in | Join | Help

Jesper's blog about integrating with Office Accounting

This blog discusses how to write applications that integrate with Office Accounting.
What do you get when using the Loader

Why use the Loader at all? 

Well - the Loader together with the overall versioning story for SBA/Office Accounting is designed to make integration as smooth as possible and take away the big hurdles of requiring external applications to control and implement their own versioning story.

In SBA 2006 you had to find the install folder for SBA in order to use a particular version AND you had to verify that the database was the correct version for those assemblies.

But with Office Accounting you can write an external application without having to worry about what assemblies to load for a given company/database and what interfaces to use.

The external application simply binds to the desired version of the SBA interfaces (usually the latest) and all future versions of Office Accounting will always implement these interfaces (and new future interfaces). The Loader will then load the correct version of the assemblies needed to use a given database and return the necessary SBA objects like FormsFactory, SmallBusinessInstance, & ReportsEngine.

You can write an application that works with SBA 2006 and be sure it also works with all future versions of Office Accounting without having to re-release the application to your customers when a new version of Office Accounting is released.

In the following blog entries I'll go over the basics of using the Loader beginning with how to get the Loader and the SBA objects and continuing with how to launch forms and reports and save SDK objects.

Posted: Friday, October 27, 2006 2:28 PM by Jesper Birk Olsen
Filed under: , ,

Comments

OldManChild said:

Hello Jesper,

Trying to develop my app using the SBA API.

Successfully created an instance of the Loader but when I call the GetSBAObjects method I get an Exception. This is the text of the Error Message = "LoaderException: Small Business Accounting runtime version required to connect to the database not found."

This is the code that generated the error:

                           ILoader SBALoaderInstance;                            

                           Microsoft.BusinessSolutions.SmallBusinessAccounting.ISmallBusinessInstanceV2 SBAInstance;

                           SBALoaderInstance =  SBAManager.SBALoader.InstantiateLoader();

                               string sbaFile = "nordic.sbc";

                               SBAInstance = SBALoaderInstance.GetSbaObjects("nordic", "OLDMANCHILD\\MSSMLBIZ",false).SmallBusinessInstance as ISmallBusinessInstanceV2;

I get the error on the last line. Do you have an idea of what I could be doing wrong.

Thanks in advance

# October 30, 2006 1:55 PM

Jesper Birk Olsen said:

Hi

This exception is thrown when the Loader could not find the version of the SBA assemblies that matches the particular database version.

The version of the database is stored in the VersionInfoTable and the Loader will compare that to the file version of SBAAPI.dll.

The Loader will use a registry key that points to the install path in order to find the assemblies. The registry key is created when you install SBA or the SBA redistributable.

So either it could not find SBAPI.dll or the versions don't match.

If you are sure that you have the SBA assemblies installed it could be that the database was created with a different build of SBA and needs to be upgraded.

I suggest you check this registry key:

[HKLM\SOFTWARE\Microsoft\Small Business Accounting\InstalledVersions] and then compare the version of the files it points to with the actual database version.

Also make sure that the files in that location are the same files that are installed in the global assembly cache (they should be in a  normal installation).

Let me know if that helps.

Thx.

# October 30, 2006 3:41 PM

OldManChild said:

It worked perfectly.

A little knowledge is always a substitute for hours of trial and error.

Problem was the database. I had created it using Small Business 2006.

I just created another one with Office Accounting 2007 B2TR and I was able to initialize an instance of ISmallBusinessInstanceV2.

Question for you?

If I manually recreate the database and tables in SQL Server Express (with the resultant filename ending with mdf/mdl) would the Loader be able to access the database and manipulate it.

I ask this because I am creating a Vehicle Maintenance Scheduling application using C# and ASP.NET 2.0. The app would be entirely browser based and would use the SBA “engine” with its predefined Customer,Supplier,Employee objects and associated algorithms.

Since I would be rolling it out to numerous clients it might not be practical to have Office Accounting create the databases each time. I would prefer an MDF File I can attach to each instance of SQL Server Express.

Thanks for solving my problem.

# October 31, 2006 10:26 AM

Jesper Birk Olsen said:

Perhaps you could also just use the Office Accounting Data Tools to attach/detach a predefined SBA database?

But I think that it will also work with any database regardless of the file extension - it only references databases through SQL anyway.

# October 31, 2006 1:56 PM

OldManChild said:

Thanks for your time and answers.I detached the SBA database(.sbc file) from SMALLBIZ and attached it instead to the default instance of SQL Server.

Works well enough for me.

Great job you guys are doing with SBA and its API.

# November 2, 2006 9:45 AM
Anonymous comments are disabled
Page view tracker