title: Adding data in the database using microsoft access and OleDb in C#
body: <p>I am new to OleDb library and I want to add a text form text box into a database with this library.
  My code:</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
      }
      private OleDbConnection conn = new OleDbConnection();
      private void button1_Click(object sender, EventArgs e)
      {
          conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Project\Learning\Visual C#\Form\WindowsFormsApplication1\WindowsFormsApplication1\Test.mdb";
          string NAME = textBox1.Text;
          conn.Open();
          OleDbCommand cmmd = new OleDbCommand("INSERT into student(NAME)" + "VALUES(@NAME)", conn);  
          if (conn.State == ConnectionState.Open)
          {
              cmmd.Parameters.Add("@NAME", OleDbType.Char, 20);
              cmmd.Parameters["@NAME"].Value = NAME;
              try
              {
                  cmmd.ExecuteNonQuery();
                  MessageBox.Show("DATA ADDED");
                  conn.Close();
              }
              catch (OleDbException expe)
              {
                  MessageBox.Show(expe.Source);
              }
          }
          else
          {
              MessageBox.Show("CON FAILED");
          }
      }
  }
  </code></pre>
  
  <p>But it doesn't work.
  I cannot find a good reference for <em>OleDbCommand</em> in C#.<br/>
  How can I use <em>OleDbCommand</em> in my code? </p>