I'm getting an error when dragging my usercontrol with a sql connection onto my form. The reason for the exception is I'm trying to access the sql connection at design time. How can I change my usercontrol that I don't get this error anymore? Where to store the connection string (in a seperate file or somewhere else ??) and how to acces it from my control?
My usercontrol class code snippet
SqlConnection sqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["REINVENT.Quality.Properties.Settings.REINVENT_QualityConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand();
//The SQL connection causes the error, how to solve?
Edit app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
//mystring
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>