ConfigFileHelper. ReadConnectionStringFromConfig( ConnectionStringKeyName) returns empty string

Posts   
 
    
jbnv
User
Posts: 2
Joined: 15-Oct-2012
# Posted on: 15-Oct-2012 20:35:47   

v3.0 Final. Runtime version 3.0.10.1025. .Net 4.0. SQL Server 8.0.2066.

This is my first attempt at using LLBL Gen. ConfigFileHelper.ReadConnectionStringFromConfig(ConnectionStringKeyName) is returning an empty string. Thus when my DataAccessAdapter attempts to read the data, it throws an exception saying the ConnectionString is empty.

App.config clearly contains the connection string:

<?xml version="1.0"?> <configuration> <appSettings> <add key="ConnectionString.SQL Server (SqlClient)" value="data source=sql-dev-00;initial catalog=master;integrated security=SSPI;persist security info=False;packet size=4096"/> </appSettings> </configuration>

Debugging reveals that ConnectionStringKeyName is in fact set to "ConnectionString.SQL Server (SqlClient)", yet the call to ConfigFileHelper.ReadConnectionStringFromConfig returns "".

I have not modified the code that LLBL Gen generated in any way. I'm not aware of my company having any other problems using LLBL Gen.

what is the problem and how do I resolve it?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Oct-2012 05:02:59   

It should work, please double-check that the app.config you are evaluating is in fact the app.config of your running application. The DBSpecific generated project contains an app.config, so maybe that is the one you said it's ok. But that connection string should exist in your running application (WinForm, ConsoleApp, Test, WebApp, etc).

David Elizondo | LLBLGen Support Team
jbnv
User
Posts: 2
Joined: 15-Oct-2012
# Posted on: 16-Oct-2012 15:50:16   

OK. I didn't realize that I needed to copy the configuration code into the application's app.config file.