title: In C# result looks successful, but data not inserted in database
body: <p>am scratching my head from couple of days, not being able to find what I did wrong. I have a database "compinfo.sdf" and table "cname" in local database.Dataset as "compinfoDataset".I am using this code to insert the data.</p>
  
  <pre><code>static class sqlFunction
  {
    static public void insert(String _compName)
    {
      static private SqlCeConnection connection =
          new SqlCeConnection(@"Data Source=|DataDirectory|\compinfo.sdf");
       try
       {
          connection.Open();
          SqlCeCommand commandInsert = new SqlCeCommand("INSERT into [cname]  VALUES (@companyName)", connection);
          commandInsert.Parameters.AddWithValue("@companyName", _compName);
          int result = commandInsert.ExecuteNonQuery();
          MessageBox.Show(result.ToString());
      }
      catch (SqlCeException exception)
      {
              MessageBox.Show(exception.ToString());
      }
      finally
      {
          connection.Close();
      }
    }
  }
  </code></pre>
  
  <p>From another class I am sending data as :</p>
  
  <pre><code>sqlfunction.insert(companyName);
  </code></pre>
  
  <p>So when this code is executed, I get the result of execution as 1 (in message box). But when I check the data in database table, its again nothing there. Please help me find the error.</p>