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 sayingand 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!Configuration system failed to initialize
Settings.Designer.CSCode: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; } }
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. } } } }




Reply With Quote