multiple connections using enterprise library 2.0

Apr 20, 2007 at 7:05 PM

I am using Enterprise library 2.0. I am trying to create multiple connection string in my web.config file.

My web.config file looks like this

<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=, Culture=neutral, PublicKeyToken=null" />
<add name="Connection String" connectionString="server=abcdef;database=team;PWD=pass;UID=sa;"
providerName="System.Data.SqlClient" />
<add name="Connection String1" connectionString="server=abcdef1;database=team1;PWD=pass;UID=sa;"
providerName="System.Data.SqlClient" />
<appSettings />

I am accessing this in my program through this code

protected void Page_Load(object sender, EventArgs e)
Database db = DatabaseFactory.CreateDatabase(ConfigurationManager.AppSettings"Connection String");
string sqlCommand = "sp_getUserId";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

// Retrieve products from the specified category.
db.AddInParameter(dbCommand, "NTLogOn", DbType.Int32, "test");

// DataSet that will hold the returned results
DataSet productsDataSet = null;

productsDataSet = db.ExecuteDataSet(dbCommand);
//return productsDataSet;


On the first line, I get an error The value can not be null or string or empty.\r\nParameter name: id. I am getting this error on
Database db = DatabaseFactory.CreateDatabase(ConfigurationManager.AppSettings"Connection String"); this line.

Any help will be appreciated.

Apr 20, 2007 at 10:35 PM
Hi vinki,

You're probably looking for the Enterprise Libary forum. This is the CodePlex site discussion forum.

Find it here: