ConnectionString property was not initialized

Posts   
 
    
rblock avatar
rblock
User
Posts: 71
Joined: 13-Mar-2009
# Posted on: 07-Feb-2013 12:15:38   

Hi,

I already searched for this over here but nothing (catchword: "IsDesignMode") solved my problem.

In a Visio 2010 Add-In, in ThisAddIn.cs, after getting all necessary values and creating a backdrop pane and a working sheet above, and when the user adds a Shape, I handle the Application_ShapeAdded. For this I just took SelfService with two classes.

There I create a new Entity, add some new values that are at least need and try to save it to the DB (MS SQL-Express 2008 R2). LLBLGen Designer worked fine with it as I took the DB first.

// For Alpha over here the Database access.
SomeEntity entity = new SomeEntity();
DocumentEntity sourceDocument = new DocumentEntity();
entity.GUID = entityGuid;
entity.IsDummy = false;
entity.PKS = "a dummy PKS";
entity.EntityID = shapeType;
SnapToGrid(
    theShape,
    true,
    entity);
try
{
    entity.Save();
}
catch (ORMQueryExecutionException exept)
{
    // always endup over here...
}

The App.config is as following, generated by LLBLGen 3.5 current build.

<appSettings>
    <add key="ConnectionString.SQL Server (SqlClient)" value="data source=MAJESTIX\SQLEXPRESS;initial catalog=SICS;integrated security=SSPI;persist security info=False;packet size=4096"/>
</appSettings>

And it doesn't matter if I start it from VS 2012 in debug mode or if I start Visio outside.

I already tried different settings in the App.config for the connection like different catalog and different security but nothing works. cry

Does anybody has an idea what the problem is, why the connection string is empty?

Asking greetings

Reiner

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 07-Feb-2013 18:02:33   

Did you place the generated connection string in the addIn project's config file?

rblock avatar
rblock
User
Posts: 71
Joined: 13-Mar-2009
# Posted on: 07-Feb-2013 18:46:53   

Hi,

that's crazy! Because by default the project template for Visio 2010 Add-Ins in VS 2012 does not create a App.config. Therefore I didn't created one by myself.

Now I copied the App.config from the DataAccess project of this add in to the Add-In project folder and it worked. simple_smile

But that's quite stupid, why does the template does not generates a config? Because it didn't I thought there must be none.

Relieved greetings

Reiner