I am hoping someone can help point me in the right direction. I was having a StackOverFlow error with my Settings.Designer.cs file. I manually regenerated the file according to this post HERE Now my Designer file looks like it is supposed to, so they tell me, but everywhere in my Class Library(30 places) that was accessing the Settings File now throws a Object reference is required error
Is this obvious to everyone else? What am I doing wrong or what do I need to do to fix this? Below are what my Settings.Designer.cs file and an example of the class library, respectively, look like.
public string CMOSQLConn {
get {
return ((string)(this["CMOSQLConn"]));
}
}
public class SupportWorker
{
public DataSet RetrieveSupportWorkers()
{
DataSet ds = new DataSet("table");
SqlConnection cnn = new SqlConnection(Settings.CMOSQLConn);
SqlCommand cmd = new SqlCommand("spSelectSupportWorkers", cnn) {CommandType = CommandType.StoredProcedure};
SqlDataAdapter da = new SqlDataAdapter(cmd);
EDIT 1
I am going to post this in hopes that if it is glaringly wrong and just seems to be correct that someone will point it out.
I replaced all instances of --> SqlConnection cnn = new SqlConnection(Settings.CMOSQLConn);
with the following -->SqlConnection cnn = new SqlConnection(Settings.Default.CMOSQLConn);
I have no idea why that makes it work but....