static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { client c = new client(12, "sd", "asd", "Asdx", "qwe", 12.09); c.connectDB(); String num = c.getfName(); c.setfName("Asdww"); String text = c.getfName(); //dbClientTest c = new dbClientTest(); // c.connectDB(); MessageBox.Show("YayY!"); int add = c.getAllClients(); //c.getClient(123); c.addClient(12, "sd", "asd", "Asdx", "qwe", 12.09); } catch (TypeInitializationException ex) { Exception e = ex.InnerException; while (e is TypeInitializationException) { e = e.InnerException; } MessageBox.Show(e.StackTrace + " " + e.GetType() + " " + e.Message); // diagnose the problem by examining e's type, message, and // stack trace here } Application.Run(new frmMain()); }
private void btnAdd_Click(object sender, EventArgs e) { try { client c = new client(12, "sd", "asd", "Asdx", "qwe", 12.09); c.connectDB(); c.addClient(12, "sd", "asd", "Asdx", "qwe", 12.09); MessageBox.Show("Records added successfully", "Success"); } catch (TypeInitializationException ex) { Exception ee = ex.InnerException; while (ee is TypeInitializationException) { ee = ee.InnerException; MessageBox.Show(ee.StackTrace); } // diagnose the problem by examining e's type, message, and // stack trace here } }