Tech Off Post

Single Post Permalink

View Thread: DatabaseFactory.CreateDatabase() method
  • User profile image

    MadTurtle wrote:
    I have a very simple program where I am taking an XML feed from a DB and writing it to a file.  I am using the Enterprise Library to create the DB connection and everything is candy and roses. 

    However, I have been asked to give the users the ability to define the DB through one of the arguements passed in as the connection string and that is where I run into this problem. 

    When I try to use the 0 argument method (DatabaseFactory.CreateDatabase()) instead of one where I pass in the name of my Database (DatabaseFactory.CreateDatabase("MyDBName")), which is defined in my App.config file, the method call throws an exception with the message "The value can not be null or an empty string."

    It seems to me that I should be able to call this method to create a Database object and then set its properties afterwards, and in fact it was suggested that I do this by two people I respect as knowledgeable individuals, but for some reason I am unable to do so.  

    I assume this is just some type of configuration issue with my App.config file but a dozen Google searches have turned up nadda.  Has anyone out there run into this type of issue before?  


    Make sure that you use the Configuarion Tool that ships with Enterprise Library to define your default connection. The markup this puts in the config file is different than you would normally use, and I don't think the database section of Enterprise Library can find it without that markup.

    Good luck!