locked
EL Jan 06: The value can not be null or an empty string. RRS feed

  • Question

  • User-237743858 posted
    This has happened to me at home several times with a website I was trying to build and eventually gave up because I could find nothing about it.  However, now I am at work and I am getting this same exception that makes no sense.

    Here is the app.config section that is importent:

    <configuration>
    <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </configSections>
    <connectionStrings>
    <add name="Connection String" connectionString="Data Source=[REMOVED];Initial Catalog=NIDB;User ID=[REMOVED];Password=[REMOVED];" providerName="System.Data.SqlClient" />
    </connectionStrings>
    </configuration>
     And here is the pretinent C# code, still very early so I don't have stored procedures yet, but that is good because you can see the sql.

    public static DataSet GetAll()
    {
    string sql = "SELECT main_entry, article_id FROM ARTICLE";
    return DatabaseFactory.CreateDatabase().ExecuteDataSet(CommandType.Text, sql);
    }
     But when I run it I get an ArgumentException that says: "The value can not be null or an empty string." where I run the DatabaseFactory stuff.  What am I doing wrong?

    I know this is a windows form (hence app.config), but it should work fine anyway right?  I'm using EL in 2 large webpojects at work and it works perfectly, but like I said it does this same crap at home when I try to use my host's sql server.
    Friday, May 19, 2006 2:43 PM

Answers

  • User-1355649840 posted
    You are missing this line in your configuration file:

      <dataConfiguration defaultDatabase="Connection String"/>

    Are you using the Enterprise Library Configuration Tool to edit your app.config file? I can't believe the tool wouldn't have added this for you...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 20, 2006 6:19 PM

All replies

  • User-1355649840 posted
    You are missing this line in your configuration file:

      <dataConfiguration defaultDatabase="Connection String"/>

    Are you using the Enterprise Library Configuration Tool to edit your app.config file? I can't believe the tool wouldn't have added this for you...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 20, 2006 6:19 PM
  • User513643335 posted
    Thanks Triax I just had same problem with my ASP Ajax application. Entlib 2.0 config tool didnt added <dataConfiguration defaultDatabase="Connection String" /> <dataConfiguration defaultdatabase="Connection String"> line !</dataConfiguration>
    Saturday, February 17, 2007 9:50 AM