Connecting to wrong database

Posts   
 
    
imakimak
User
Posts: 62
Joined: 18-Mar-2010
# Posted on: 03-Feb-2011 16:36:57   

Environment .NET 3.5 Self Servicing LLBL Pro 2.6

I know I might be doing something stupid here. I have following code


 string connectionString = ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString;
            DbUtils.ActualConnectionString = connectionString;

            
            PersonCollection ps = new PersonCollection();
            ps.GetMulti(new PredicateExpression(Person.Lastname == "lastname" ));
            Console.WriteLine(pt.Count);

Now when I generated the entities from LLBL Studio, I used a db named ForGeneratingLLBL but in app.config connection string is pointing to another db **Master **. My expection is that program will retrieve data from whatever is defined in DbUtils.ActualConnectionString (which in this case is defined in app.config) but for some reason its still retreiving data from ForGeneratingLLBL. Any idea what i am doing wrong here?

imakimak
User
Posts: 62
Joined: 18-Mar-2010
# Posted on: 03-Feb-2011 17:01:31   

BTW this is how my app.config is setup

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler" />
    </configSections>
    <sqlServerCatalogNameOverwrites>
        <add key="ForGeneratingLLBL " value="" />
    </sqlServerCatalogNameOverwrites>
    <connectionStrings>
        <add name="MyConn" connectionString="Data Source=MYPC,1433;Network Library=DBMSSOCN;Initial catalog=Master;Integrated Security=False;User=user;Password=password;" />
    </connectionStrings>
</configuration>
imakimak
User
Posts: 62
Joined: 18-Mar-2010
# Posted on: 03-Feb-2011 19:37:59   

Please disregard the message; figured what i was doing wrong. Marked it as done