StrataFrame Forum

Newbie SetConnection help

http://forum.strataframe.net/Topic22495.aspx

By Kirk M Sherhart - 3/27/2009

I'm working my way through the tutorials and have hit a snag trying to establish a db connection. If I use the following...



ConnectionManager.ApplicationKey = "App1";

ConnectionManager.ApplicationDefaultTitle = "App1 Connection";

ConnectionManager.ApplicationDefaultDescription = "This application connection is used by App1";



ConnectionManager.SetConnections();





then the application starts, brings up the Connection Wizard, I enter the Oracle connection info (for TNSNAMES, etc.) and then bombs with the following message



The program '[2308] App1.exe: Managed' has exited with code -1073741819 (0xc0000005).




But, if I use the following...





ConnectionManager.ApplicationKey = "App1";

ConnectionManager.ApplicationDefaultTitle = "App1 Connection";

ConnectionManager.ApplicationDefaultDescription = "This application connection is used by App1";



DataLayer.DataSources.Add(new OracleDataSourceItem("", "Data Source=STSGEO;user id=abc;password=xyz;"))





it works! Any help is much appreciated!!!




By Aaron Young - 3/27/2009

I am no expert on this but it sounds like the Connection Wizard is not saving the connection string. I have seen this before on Vista so, if you are running Vista, try running your application as Administrator and see if the connection string is saved.



Aaron
By Trent L. Taylor - 3/27/2009

You are missing the AddRequiredDatasource calls.  You have to tell the connection manager what data sources are expected.

ConnectionManager.ApplicationKey = "App1";
ConnectionManager.ApplicationDefaultTitle = "App1 Connection";
ConnectionManager.ApplicationDefaultDescription = "This application connection is used by App1";

ConnectionManager.AddRequiredDataSourceItem("", "Oracle Connection",
                DataSourceTypeOptions.Oracle, "MyDatabaseName", "This connection is used by App1.");

ConnectionManager.SetConnections();