title: I've got a C# Windows Forms to input values into a SQL Server database that just wont working, no errors though?
body: <p>I've created a simple Windows form to input data into a SQL Server database table. On the surface, it seems fine, no errors, but after submitting data into table, that data doesn't appear. I've looked at the where the connection is pointing and that seems fine. so I'm stuck at the moment. Any help would be great.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.Data.SqlClient;
  
  namespace WindowsFormsApp7
  {
      public partial class Onbutton1_Click : Form
      {
          public Onbutton1_Click()
          {
              InitializeComponent();
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              try
              {
                  String str = 
  "den1.mssql7.gear.host;database=generic;UID=generic;password=Generic";
                  String cmdText1 = "INSERT INTO TEST1 (Name) VALUES ('%'+ @Name + '%')";
                  String cmdText2 = "INSERT INTO TEST1 (Age) VALUES ('%'+ @Age + '%')";
  
                  SqlConnection con = new SqlConnection(str);
  
                  SqlCommand cmd1 = new SqlCommand(cmdText1, con);
                  SqlCommand cmd2 = new SqlCommand(cmdText2, con);  
                  cmd1.Parameters.Add("@Name", SqlDbType.VarChar, 255).Value =  textBox1.Text;
                  cmd2.Parameters.Add("@Age", SqlDbType.VarChar, 255).Value = textBox2.Text;
  
                  con.Open();
  
                  cmd1.ExecuteNonQuery();
                  cmd2.ExecuteNonQuery();
  
                  DataSet ds = new DataSet();
                  con.Close();
          }
          catch (Exception es)
          {
              MessageBox.Show("Complete");
          }
      }
  }
  </code></pre>