Results 1 to 1 of 1

Thread: problem with my Settings in my Project Designer

Threaded View

  1. #1

    Thread Starter
    Fanatic Member daimous's Avatar
    Join Date
    Aug 2005
    Posts
    657

    problem with my Settings in my Project Designer

    hi guyz! can you help me with my problem. I have the code below the db_connection () every time I call it it always give me an error message saying
    Configuration system failed to initialize
    and i can't figura out what the problem is I post also my Setting.Designer.cs where i think problem occurs. Can anybody please help me with this. Thanks!

    Code:
            public bool  db_Connection()
            {
                try
                {
                    //string sqlConnStr = Properties.Settings.Default.MyConnectionString;
                    string sqlConnStr = Properties.Settings.Default.ConnString;
                    sqlConn = new SqlConnection(sqlConnStr);
                    sqlConn.Open();
                    return true;
                }
                catch (System.Data.SqlClient.SqlException ex)
                {
                    MessageBox.Show("db_Connection Function error:" + ex.Message, "BCMD");
                    return false;
                }
            }
    Settings.Designer.CS

    Code:
    namespace WindowsApplication1.Properties {
        
        
        [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
        internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
            
            private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
            
            public static Settings Default {
                get {
                    return defaultInstance;
                }
            }
            
            [global::System.Configuration.ApplicationScopedSettingAttribute()]
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.Configuration.DefaultSettingValueAttribute("Generate")]
            public string generate_txt {
                get {
                    return ((string)(this["generate_txt"]));
                }
            }
            
            [global::System.Configuration.ApplicationScopedSettingAttribute()]
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.Configuration.DefaultSettingValueAttribute("Data Source = DAIMOUS\\SQLEXPRESS; Initial Catalog=BCMDDB; User ID=test; Password=" +
                "test;")]
            public string ConnString {
                get {
                    return ((string)(this["ConnString"])); //It is here where the problem Occurs.
                }
            }
        }
    }
    Last edited by daimous; Aug 25th, 2006 at 08:08 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width